Monday, 15 March 2010

sql - Update throws "Invalid column name" when the query doesn't mention that column -



sql - Update throws "Invalid column name" when the query doesn't mention that column -

i have stored procedure simple update on table:

alter procedure [dbo].[sp_updatemodel] ( @status int, @name nvarchar(127), -- ... omited brevity ... @tourlink nvarchar(256), @original_id int ) update dbo.models set status = @status, name = @name, -- ... omited brevity ... tourlink = @tourlink (id = @original_id)

(omited portions of procedure more parameter definitions , updates, nil fancy)

this procedure worked fine until added new column underlying table dbo.models called tourlinkcoverimage of type nvarchar(256). field nullable, shouldn't need include in update statement (it's updated separately in procedure.)

i can set value of column , query it's value successfully, procedure above throws next error:

msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'.

why procedure throw error? how can prepare it?

check trigger on table. guess 1 exists , it's doing form of insert target table.

"triggers voodoo code; update value, , lights go off in building next door" - richard campbell, pass presentation, 2008

sql sql-server-2008 tsql stored-procedures sql-update

No comments:

Post a Comment