什么情况下完成?? update tablename set columnname='B' 呵呵也可以完成。
----生成测试数据表,id列为标识列,用于定位行. create table tab (id int IDENTITY,A int,B int) GO ----创建插入触发器,使新插入行的A列值等于B列值. create trigger t on tab for insert as update tab set A = x.B from tab as x,inserted as i where x.id = i.id go ----插入测试数据 insert tab(B) select 9 union all select 8 union all select 7 union all select 6 union all select 5 ----显示触发器是否成功 select * from tab ----删除测试对象 drop trigger t drop table tab
create table test ( id int identity(1,1) , b int , a default b )
create table test ( id int identity(1,1) , b int , a default b ) ================================ 这个对吗 a default b ???????????
create table test ( id int identity(1,1) , b int , a as b )
update tablename
set columnname='B'
呵呵也可以完成。
create table tab (id int IDENTITY,A int,B int)
GO
----创建插入触发器,使新插入行的A列值等于B列值.
create trigger t on tab for insert
as
update tab set A = x.B from tab as x,inserted as i where x.id = i.id
go
----插入测试数据
insert tab(B)
select 9 union all
select 8 union all
select 7 union all
select 6 union all
select 5
----显示触发器是否成功
select * from tab
----删除测试对象
drop trigger t
drop table tab
id int identity(1,1) ,
b int ,
a default b
)
create table test (
id int identity(1,1) ,
b int ,
a default b
)
================================
这个对吗 a default b ???????????
id int identity(1,1) ,
b int ,
a as b
)