Updating table variables

Rated 3.81/5 based on 927 customer reviews

-- We can add a table in the same format as the variable & -- then check what values were passed, if necessary.

-- The INSERT for this scenario is commented out at the end.

CHECKERS to debug @CHECKERS, so clearly some original problem existed which started this all; but regardless, the problem has been resolved and the trigger works just fine.

Quantity4 END FROM Orders O INNER JOIN @CHECKERS C ON O. Order Num -- This is the INSERT which populates the debug table, if you want.

-- Does **NOT** fire from primary stored procedure (dictated by Update Record Date).

BEGIN -- Table variable for storing **multi-row updates** -- Using scalar variables will not work! DECLARE @CHECKERS AS TABLE ( Order Num INT, Old_DCB INT, New_DCB INT, Old_MC INT, New_MC INT, Old_P2 NUMERIC(28,3), New_P2 NUMERIC(28,3), Old_PQ NUMERIC(28,3), New_PQ NUMERIC(28,3), Old_QT NUMERIC(28,3), New_QT NUMERIC(28,3) ) -- Old & new values populated to table variable.

State Name as City State from Cashsafes c inner join Stores s on s.

However the syntax for your update query, you can append the where condion in last if required.

Leave a Reply