I just added an identity column to an existing table with data through the SSMS
Designer, the table updates fine and I can run a select query against it successfully, but after the query finishes I noticed that the new column is underlined in red with an error indicating it's an invalid column name.
Why does this occur? I would expect the query to fail if the column was invalid.
Does the SSMS keep some type of internal reference to the old table that must be flushed?
I tried closing the DB connection and reopening it, but still the same error. Not sure what I'm missing here.
SELECT TOP 100 [PRIMARY_NDX_Col1], [NEW_Col], --QUERY EXECUTES SUCCESSFULLY, BUT THIS IS UNDERLINED RED AS AN INVALID COLUMN [Col3] FROM [dbo].[MyTable]
An invalid column name error in SQL means that the column name violates the conditions of the column name. If you reference an object that does not exist in the table or the name exists, but you did not reference it correctly, you will get this error.
One of the simplest ways to solve an “ambiguous name column” error — without changing column name — is to give the tables you want to join an alias. This sends a clear information to the SQL Machine the columns are different. Happy querying.
Column names must contain only A to Z, 0 to 9, and underscore (_) characters. Column names can contain multiple underscores. The column name must not be very generic. Avoid words such as term, multiplier, description, name, code, and so on.
you can either
OR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With