我是新创建触发器。我试图创建一个触发器,用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