代码改变世界

sqlserver output

2012-06-04 13:42  java环境变量  阅读(335)  评论(0编辑  收藏  举报

 

create table t3
(
sid int not null primary key,
sname varchar(10)
)

insert into t3 values(101,'wind')
insert into t3 values(102,'snow')
insert into t3 values(103,'kiki')

select * from t3


select * into t4 from t3 where 1=0

select * from t4

----insert


insert into t4
output inserted.sid,inserted.sname
select sid,sname from t3

---update
--返回update字段前后的值
update t4 set sname='snow'
output deleted.sname,inserted.sname
where sid=101


----delete
--返回删除的值
delete t4
output deleted.sid,deleted.sname
 where sid=103