"Invalid Object Name" when creating new tables.
PaulKahl
Posts: 5 Bronze 2
Using SQL Prompt, I'm writing scripts to first create a new table, and then do some inserts against that new table. The scripts work but they show false errors. The error goes away if I restart SSMS, but as long as SSMS is open in the same session as I created the table, any use of that table is chock full of red underlines saying that none of the table/columns/objects exist. And this is after I've done the old "Ctrl+Shift+D" to refresh my object list.
Here's a screenshot of the issue:
I created that table, then opened a new query window to write that insert script, and it says the table doesn't exist. Even though it pulled the column names and definitions perfectly fine when creating the insert statement.
How do I make this false error not happen?
Here's a screenshot of the issue:
I created that table, then opened a new query window to write that insert script, and it says the table doesn't exist. Even though it pulled the column names and definitions perfectly fine when creating the insert statement.
How do I make this false error not happen?
Tagged:
Answers
Sean Quigley | Product Support Engineer | Redgate Software
Have you visited our Help Center?
SSMS v17.9.1
Sean Quigley | Product Support Engineer | Redgate Software
Have you visited our Help Center?
I ran the Create, and the Insert, then commented them out and ran the Select - the select runs perfectly (because the table exists), but it indicates the table isn't there, and when you mouse over, says "Invalid object name 'PKTestTable'." (Even after the old Ctrl+Shift+D to rebuild the references.)
Sean Quigley | Product Support Engineer | Redgate Software
Have you visited our Help Center?
Sean Quigley | Product Support Engineer | Redgate Software
Have you visited our Help Center?