扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:yuhq 来源:BLOG 2007年10月22日
关键字: SQL Server
在本页阅读全文(共2页)
SELECT * INTO CustomersGer FROM Customers WHERE Customers.Country = 'Germany' SELECT * INTO CustomersMex FROM Customers WHERE Customers.Country = 'Mexico' GO |
CREATE VIEW CustomersView AS SELECT * FROM CustomersGer UNION SELECT * FROM CustomersMex GO |
CREATE TRIGGER Customers_Update2 ON CustomersView INSTEAD OF UPDATE AS DECLARE @Country nvarchar(15) SET @Country = (SELECT Country FROM Inserted) IF @Country = 'Germany' BEGIN UPDATE CustomersGer SET CustomersGer.Phone = Inserted.Phone FROM CustomersGer JOIN Inserted ON CustomersGer.CustomerID = Inserted.CustomerID END ELSE IF @Country = 'Mexico' BEGIN UPDATE CustomersMex SET CustomersMex.Phone = Inserted.Phone FROM CustomersMex JOIN Inserted ON CustomersMex.CustomerID = Inserted.CustomerID END |
UPDATE CustomersView SET Phone = ' 030-007xxxx' WHERE CustomerID = 'ALFKI' SELECT CustomerID, Phone FROM CustomersView WHERE CustomerID = 'ALFKI' SELECT CustomerID, Phone FROM CustomersGer WHERE CustomerID = 'ALFKI' |
CREATE TRIGGER [calT1T2T3] ON dbo.DCLB FOR INSERT,UPDATE AS update P SET /**//* 计算方差的触发器 */ P.T1=(I.P1+I.P2+I.P3+I.P4+I.P5+I.P6), P.T2=(I.Y1+I.Y2+I.Y3+I.Y4+I.Y5+I.Y6 ), P.T3=SQRT(P.T1*P.T1+P.T2*P.T2) FROM DCLB AS P INNER JOIN Inserted AS I ON P.SID = I.SID |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者