How do I get my temp table to bind so I can update my records
I am getting the Following Error when i try to run a update to match data from my temp table created. Msg 4104, Level 16, State 1, Line 3 The multi-part identifier "#
t.No Response Letter" could not be bound. Msg 4104, Level 16, State 1, Line 3 The multi-part identifier "#
T.No Tax Statment" could not be bound. begin tran update contacts Set contacts.NoResponseLetters = #t."No Response Letter",contacts.NoTaxStatements = #T."No Tax Statment" where contacts.contactid in ( select contacts.contactid from contacts Join [dbo].[#t] on dbo.[#t].contactid = contacts.contactid ) Any thoughts??
As Magnus said, the temp table will need to be directly referenced in the update statement rather than in a subquery. Your query reminds me of Oracle syntax, but the way to do this in SQL Server is by joining the tables in a FROM clause. Try this: UPDATE c SET NoResponseLetters = t.[No Response Letter] , NoTaxStatements = t.[No Tax Statement] FROM contacts c INNER JOIN #t t ON t.contactid = c.contactid ;