1
我在一個表上創建一個觸發器,它應該更新date_modified
列。下面的代碼是最好的方法來做到這一點?我做對了嗎?SQL Server 2008更新觸發器 - 更新某些列方法
IF EXISTS(SELECT * FROM DELETED) --checking if this is an update, not insert
BEGIN
IF NOT(UPDATE(date_modified)) -- checking if desired column was not updated
BEGIN
DECLARE @updatedID int
SELECT @updatedID = ID FROM deleted -- fetching updated record ID
UPDATE table SET date_modified=GETDATE() WHERE [email protected] -- updating desired column
END
對不起,更新平臺數據導入後和話題 – 2012-07-19 11:17:49
致謝!現在更清楚了! – 2012-07-19 11:39:41