0
我的表結構就像itemcode,大小,套,件。所以人插入我的時間將像「S0001」的數據,「F」,「96」需要插入項目字段數據,如'S0001-f-96'我該如何編寫觸發器。如何調用觸發同時插入數據
我的表結構就像itemcode,大小,套,件。所以人插入我的時間將像「S0001」的數據,「F」,「96」需要插入項目字段數據,如'S0001-f-96'我該如何編寫觸發器。如何調用觸發同時插入數據
創建TRIGGER [DBO] [名稱] ON [DBO] [表] 爲INSERT AS DECLARE @Itemcode VARCHAR(30)。。 declare @Itemname varchar(40); declare @Slv varchar(1); declare @Createdate datetime; declare @audit_action varchar(100);
select @Itemcode=i.ItemCode from inserted i;
select @Itemname=i.ItemName from inserted i;
select @Slv =i.U_SLV from inserted i;
select @Createdate =i.Createdate from inserted i;
set @audit_action='Inserted Record -- After Insert Trigger.';
update OITM_CLONE set sapitem [email protected]+'-'[email protected] where [email protected] and [email protected] and [email protected];
PRINT 'AFTER INSERT trigger fired.'
是這樣的嗎?
您首先查看:http://technet.microsoft.com/en-us/library/ms189799.aspx並嘗試自己動手。 –
作爲計算列而不是通過觸發器來實現看起來已經成熟。 –
...和OP的下一個SO問題:我有像'S0001-f-96'這樣的數據,但是我怎樣才能選出只有'f' ... –