我是新創建觸發器。我試圖創建一個觸發器,用tblAccounts.HotNote更新tblServiceOrders.GeneralSymptoms,其中tblAccounts.Number = tblServiceOrders.AccountNumber,以及每當將新行添加到tblServiceOrders時。這是我到目前爲止。使用Where Filter創建更新觸發器
ALTER TRIGGER [dbo].[HOTNOTE_update] ON [dbo].[tblServiceOrders]
AFTER INSERT
AS
BEGIN
UPDATE tblServiceOrders tblAccounts.AccountNumber = tblServiceOrders.AccountNumber
SET GeneralSymptoms =
(
SELECT HotNote FROM tblAccounts, tblServiceOrders
WHERE tblAccounts.AccountNumber = tblServiceOrders.AccountNumber
)
FROM tblServiceOrders
WHERE tblServiceOrders.SOType = 'BE Maintenance' OR tblServiceOrders.SOType = 'DD Maintenance'
END
您正在使用哪種RDBMS? SQL Server(自dbo以來)... – sgeddes 2013-03-18 03:29:52