---假设在SQL SERVER 2005里面有一张表,其中有两个字段需要做唯一性约束, ---不能有重复值,但是允许其为空值,如果都是空值,则允许重复 CREATE TRIGGER [dbo].[insert] ON [dbo].[table1] INSTEAD OF INSERT AS BEGIN declare @i int; declare @errmsg char; declare cursor1 cursor for select count(*) num from inserted…
更新: CREATE TRIGGER `r_users_1` AFTER UPDATE ON `users` FOR EACH ROW update `wxusers` set status=NEW.status where wxusers.uid = new.id; 删除触发器:drop trigger r_users_1;…
if OBJECT_ID('tempdb..#temp') is not null drop table #temp select * into #temp from ( --select * from Activity as 'day' union all as 'day' union all as 'day' union all as 'day' union all as 'day' ) as A select * from #temp…
update 触发器: if(OBJECT_ID('trigger_compost_up') is not null) drop trigger trigger_compost_up go create trigger trigger_compost_up on t_com_post -- 指定创建触发器的表 for update -- update 触发器,也可以写为 after update as declare @postid int ) if UPDATE(name) begin sel…