I have two tables that i added a new column to. The column name is LocationKey. Whenever i try and use that column in a alter stored procedure i get a error message below. I went back and copy pasted the column name. It is exact! it is where it needs to be on both tables.
Msg 207, Level 16, State 1, Procedure usp_MY_Stored_procedure, Line 122
Invalid column name 'LocationKey'.
I have googled and nothing that i came up with has resolved the problem. What could i be missing?
Link i have read: 1. "Invalid column name" error when calling insert after table created
Anything i can try to troubleshoot this further would be greatly appreciated.
-- DROP LEADING DOUBLE QUOTE (and PhotoUrl column)
INSERT INTO [table2](
[Comment1]
,[Comment 2]
,[Comment 3]
,[Comment 4]
,[Name]
,[PhotoUrl]
,[LocationKey]
)
SELECT
[Comment1]
, [Comment 2]
, [Comment 3]
, [Comment 4]
, SUBSTRING([Name],1,100)-- Limit to 100 chars
, [PhotoUrl] -- varchar(MAX)
, [LocationKey]
FROM [table1]