Inserted   deleted  个人理解 应该是两个 临时表   分别存储 变动后的数据集  和  变动前的数据集

使用例子:

1.对于INSERT,可以引用inserted表以查询新行的属性.

   insert into [表名] (a) OUTPUT Inserted.a values ('a')     

2.对于DELETE,可以引用deleted表以查询旧行的属性.

   delete [表名] OUTPUT deleted.a where links = 'a'

3.对于UPDATE,使用deleted表查询被更新行在更改前的属性,用inserted表标识被更新行在更改后的值.

   update [表名] set a = 'b' OUTPUT Inserted.a where a = 'a'(返回修改后的值)

   update [表名] set a = 'b' OUTPUT deleted.a where a = 'a' (返回修改前的值)

文章来源:http://lin358.iteye.com/blog/1928121

OUTPUT 在insnert delete update 的神奇功效的更多相关文章

  1. sql server 带有OUTPUT的INSERT,DELETE,UPDATE

    原文:sql server 带有OUTPUT的INSERT,DELETE,UPDATE OUTPUT是SQL SERVER2005的新特性.可以从数据修改语句中返回输出.可以看作是"返回结果 ...

  2. 带有OUTPUT的INSERT,DELETE,UPDATE

    原文地址:http://blog.sina.com.cn/s/blog_71460d950100nld2.html OUTPUT是SQL SERVER2005的新特性.可以从数据修改语句中返回输出.可 ...

  3. mysql并发insert deadlock分析以及解决,无delete/update/for update

    关于并发insert操作发生deadlock这个情况,一直有很多争议,而且网上的帖子所有的例证和模拟其实不一定反映了真实的情况,例如:https://www.percona.com/blog/2012 ...

  4. 基于游标的定位DELETE/UPDATE语句

    如果游标是可更新的(也就是说,在定义游标语句中不包括Read Only 参数),就可以用游标从游标数据的源表中DELETE/UPDATE行,即DELETE/UPDATE基于游标指针的当前位置的操作: ...

  5. Linq无聊练习系列7----Insert,delete,update,attach操作练习

    /*********************Insert,delete,update,attach操作练习**********************************/            ...

  6. Use Select To Generate Any Insert/Delete/Update Statement

    If you don't have the permission to generate script according to an existing db, but you have the re ...

  7. sqlserver触发器insert,delete,update

    Create Trigger [dbo].[upemployee_kefyu_sale] on [dbo].[employee] for update as if update(FullName) b ...

  8. MySQL进阶10--DML数据操纵预言: insert/delete/update --多表连接修改/.多表连接删除/多表连接查询-- truncate 和 delete的区别

    /* DML -- 数据操纵预言: insert/delete/update */ #一: 插入语句 /* 语法1: insert into 表名(列名,..,列名....) values(值1,值2 ...

  9. MySql 执行 DELETE/UPDATE时,报 Error Code: 1175错误

    MySql 执行 DELETE FROM Table 时,报 Error Code: 1175. You are using safe update mode and you tried to upd ...

随机推荐

  1. Python模块解析之SocketServer(三)——模块思想

            SocketServer 体系 由两个部分构成 BaseServer 和 BaseRequestHandler.思想很简单 BaseServer接受请求,将请求交给BaseReques ...

  2. VLAN间通信----实验

        方法1.增加物理线路     需求:PC0连接SW的F0/1,PC1连接SW的F0/2; SW创建VLAN10,VLAN20; PC0划到VLAN10; PC1划到VLAN20; 现要求借用路 ...

  3. start-tomcat7.launch

    <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launc ...

  4. BZOJ 1011 遥远的行星

    Description 直线上N颗行星,X=i处有行星i,行星J受到行星I的作用力,当且仅当i<=AJ.此时J受到作用力的大小为 Fi->j=Mi*Mj/(j-i) 其中A为很小的常量,故 ...

  5. BZOJ 3091 城市旅行

    Description Input Output Sample Input 4 5 1 3 2 5 1 2 1 3 2 4 4 2 4 1 2 4 2 3 4 3 1 4 1 4 1 4 Sample ...

  6. Deferred

    http://blog.allenm.me/2012/01/jquery_deferred_promise_method/ http://www.ruanyifeng.com/blog/2011/08 ...

  7. sql restore mode

    refer : https://msdn.microsoft.com/en-us/library/ms189272.aspx SELECT name, recovery_model_desc FROM ...

  8. VBA -excel --遍历行

    Sub filter1()Rem MsgBox ("AAAAA")Rem 1 get selected zoneRem 2 loop rows and check columnRe ...

  9. 23个经典JDK设计模式(转)

    下面是JDK中有关23个经典设计模式的示例: Structural(结构模式) Adapter: 把一个接口或是类变成另外一种. o    ● java.util.Arrays#asList() o  ...

  10. Spring MVC学习总结。

    公司项目用的Spring MVC.顺便学习学习. 其实框架并没有想象中的复杂.尤其对于初学者,总觉得SSH是一些很复杂的东西似的.其实对初学者来说能够用这些框架就足够了.在公司里也是,基本功能会用了就 ...