1、不允许任何人删除数据 CREATE TRIGGER TG ON [dbo].[TABLE] instead of DELETE AS return2、 CREATE TRIGGER [TRIGGER] ON [dbo].[TABLE] instead of insert AS insert into tb (a,其他列,其他列,其他列) select(select square(sqrt(isnull(max(wewe),0))+1) from tb) ,a.其他列 ,a.其他列 ,a.其他列 from inserted
2、在数据追加时,根据最大编号开平方加1后再平方作为新记录的a列值CREATE TRIGGER [TRIGGER] ON [dbo].[TABLE] instead of insert AS insert into tb (a,其他列,其他列,其他列) select(select square(sqrt(isnull(max(wewe),0))+) from tb) ,a.其他列 ,a.其他列 ,a.其他列 from inserted a
WEWE就是A列CREATE TRIGGER [TRIGGER] ON [dbo].[TABLE] instead of insert AS insert into tb (a,其他列,其他列,其他列) select(select square(sqrt(isnull(max(a),0))+) from tb) --这里换一下 ,a.其他列 ,a.其他列 ,a.其他列 from inserted a
alter TRIGGER [T_Table_ins] ON [dbo].[Table] instead of insert ASdeclare @Max int , @New int select @max = max(aa) from Table set @New = sqrt(@max) + 1 set @New = @New * @Newinsert into Table (aa,bb) select @New,bb from inserted
1、不允许任何人删除数据
2、在数据追加时,根据最大编号开平方加1后再平方作为新记录的a列值
应该是1,2,9,16,25,36,49--->1,4,9,16,25,36,49..吧
CREATE TRIGGER TG ON [dbo].[TABLE]
instead of DELETE
AS
return2、
CREATE TRIGGER [TRIGGER] ON [dbo].[TABLE]
instead of insert
AS
insert into tb (a,其他列,其他列,其他列)
select(select square(sqrt(isnull(max(wewe),0))+1) from tb)
,a.其他列
,a.其他列
,a.其他列
from inserted
instead of insert
AS
insert into tb (a,其他列,其他列,其他列)
select(select square(sqrt(isnull(max(wewe),0))+) from tb)
,a.其他列
,a.其他列
,a.其他列
from inserted a
instead of insert
AS
insert into tb (a,其他列,其他列,其他列)
select(select square(sqrt(isnull(max(a),0))+) from tb) --这里换一下
,a.其他列
,a.其他列
,a.其他列
from inserted a
instead of insert
ASdeclare @Max int ,
@New int
select @max = max(aa) from Table
set @New = sqrt(@max) + 1
set @New = @New * @Newinsert into Table (aa,bb)
select @New,bb from inserted