首页 > 数据库技术 > 详细

SQL Server 输出受影响的行

时间:2014-10-25 08:08:34      阅读:275      评论:0      收藏:0      [点我收藏+]

前期准备:

  create table Nums(X int);

  create table T(X int);

  go

  目的:把对表Nums的insert | delete | update 反映到T表中。

---------------------------------------------------------------------------------------------------------------------------------------------

insert :

  insert into Nums(X)

  output inserted.X #记得它在列表之后

  into T(X)

  values(1),(2),(3);

deleted:

  delete Nums

  output deleted.X#它在表名之后
  into T(X);
  go

update:

  update Nums
  set X = 100
  output inserted.X#它在set 之后
  into T(X);
  go

 

SQL Server 输出受影响的行

原文:http://www.cnblogs.com/JiangLe/p/4049664.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!