I have created the following trigger that inserts data into a SQL table when a specific column is updated. I would also like to obtain the current value of certain columns of the updated row. To do this, I've been using the INSERT command, but I keep receiving NULL values in return. This is the code:
CREATE TABLE [Main] (
[USerial] varchar(10) NOT NULL,
[Status] varchar(10) NULL)
CREATE TRIGGER [Status_Notification] ON [Main] WITH EXECUTE AS CALLER AFTER UPDATE AS if update(status)
SET NOCOUNT ON
declare @xml_value xml
declare @P_number varchar(10)
declare @status varchar(10)
-- Select data and build XML
set @pnr_number = (select d.userial from main m inner join deleted d on m.userial = d.userial) set @xml_value = '<MAIN><Number>333</Number><Status>Cancel</Status></MAIN>'
-- Insert an entry into the table
insert into q_out
Do you have any idea why this is happening?
November 10, 2008 7:27 PM
November 10, 2008 10:52 PM