sqlserver 列觸發器

林堯彬發表於2020-04-04

USE [OHKUMADB] GO /****** Object: Trigger [dbo].[test] Script Date: 09/30/2013 14:04:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Batch submitted through debugger: SQLQuery6.sql|7|0|C:\Documents and Settings\FBSE\Local Settings\Temp\~vs53E.sql

ALTER trigger [dbo].[test] on [dbo].[user] for update as

declare @name1 varchar(20); declare @name2 varchar(20); s

elect @name2 = name from inserted;

select @name1 = name from deleted; print @name2;

print @name1; if(@name2!=@name1)

begin

print '姓名變化';

end

insert into dbo.people(name,age) values('11','13'); print '新增學生成功!';

update [dbo].[user] set name='lijinlong2' where id=1

轉載於:https://www.cnblogs.com/btbear/p/3347199.html

相關文章