惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
Cloudbric
Cloudbric
The Register - Security
The Register - Security
小众软件
小众软件
PCI Perspectives
PCI Perspectives
G
Google Developers Blog
AI
AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
TaoSecurity Blog
TaoSecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
F
Full Disclosure
N
Netflix TechBlog - Medium
博客园_首页
Last Week in AI
Last Week in AI
A
Arctic Wolf
B
Blog RSS Feed
J
Java Code Geeks
C
Cybersecurity and Infrastructure Security Agency CISA
I
InfoQ
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
NISL@THU
NISL@THU
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Jina AI
Jina AI
有赞技术团队
有赞技术团队
S
Schneier on Security
L
Lohrmann on Cybersecurity
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
P
Palo Alto Networks Blog
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Security Latest
Security Latest
Vercel News
Vercel News
博客园 - 司徒正美
Webroot Blog
Webroot Blog
Hacker News: Ask HN
Hacker News: Ask HN
A
About on SuperTechFans

博客园 - Clark Zheng

怎样带出一支成功的团队 Google Data APIS应用 实现ICallbackEventHandler应该注意的问题 mime类型大全 联合删除两张表的数据 现在的收藏功能到底把文章收藏在哪里了? Google Reader终于出中文版啦 KB937061安全更新到底要打几次?! 如何解决北京高峰期堵车的问题? 新的皮肤 一段非常有意思的程序 只需一行代码就能让IE6崩溃 [转]随便说说字符集和编码 利用 ASP.NET AJAX 使 Web Parts 可以在 FireFox 中拖曳 SQLServer2005 利用 ROW_NUMBER 实现分页 清除 SQL SERVER 2005 事务日志 Windows Live Writer升级到1.0(12.0.1193.524)了 热烈庆祝博客园搬家成功! “LIB 环境变量”中指定的搜索路径 *** 无效 --“系统找不到指定的路径。”
SQL2005支持的两条新语法
Clark Zheng · 2007-11-22 · via 博客园 - Clark Zheng

1. OUTPUT ... INTO

用于将一条记录从表一移动到表二时非常好用,常见于备份记录的应用

例一:

DELETE [TableUseing] 
OUTPUT Deleted.* 
INTO [TableBak]

例二:(用于移动时修改某字段的值)

DELETE [TableUseing] 
OUTPUT Deleted.Field1, Deleted.Field2, GETDATE() 
INTO [TableBak]

2.表变量

用于存储临时的查询结果

DECLARE @tmp TABLE (ID INT, CITY NVARCHAR(50))
INSERT INTO @tmp 
SELECT MIN(ID), CITY  
FROM [TableTest] WITH(NOCLOCK) 
GROUP BY CITY