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

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Y
Y Combinator Blog
O
OpenAI News
K
Kaspersky official blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
S
SegmentFault 最新的问题
L
Lohrmann on Cybersecurity
S
Securelist
C
CERT Recently Published Vulnerability Notes
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
Jina AI
Jina AI
大猫的无限游戏
大猫的无限游戏
V
Vulnerabilities – Threatpost
量子位
爱范儿
爱范儿
I
Intezer
博客园 - 叶小钗
The Hacker News
The Hacker News
N
News and Events Feed by Topic
Project Zero
Project Zero
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy & Cybersecurity Law Blog
Google Online Security Blog
Google Online Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Heimdal Security Blog
NISL@THU
NISL@THU
V
Visual Studio Blog
The Last Watchdog
The Last Watchdog
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
小众软件
小众软件
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Schneier on Security
雷峰网
雷峰网
B
Blog RSS Feed
美团技术团队
T
Threat Research - Cisco Blogs
Engineering at Meta
Engineering at Meta
Recent Announcements
Recent Announcements
N
Netflix TechBlog - Medium
月光博客
月光博客
S
Security Affairs

博客园 - 旴江老段

委托和事件的区别 如何开发和维能hold住全场的软件 什么样的软件才能hold住全场 SNOOP 开发WPF的好工具 被遗忘的事物 前台线程和后台线程(Foreground and Background Threads) runtime binding policy Checking space used in a database AsyncCallback方法和主线程怎么同步呢? Remoting Practice Sample Using Custom Assemblies with Reports 为什么32位的CPU?为什么32位的CPU只能支持4G的内存呢? 学习SSL和certificate的好网页 Wix Upgrade怎么判断是否更新 学WIX的好网站 sql server try catch and transaction的几个要点 使SQL关键字变大写的小工具 Assert.AreEqual .net 异步调用机制
SELECT @local_variable (Transact-SQL)
旴江老段 · 2009-04-01 · via 博客园 - 旴江老段

先想想select @a 都会返回什么值。

use AdventureWorks
go

declare @a varchar
select @a
select @a = 'a' from Production.Culture where 1 = 2
select @a
select @a = 'b'
select @a
select @a = 'a' from Production.Culture where 1 = 2
select @a

在看看MSDN的解释

Remarks

SELECT @local_variable is typically used to return a single value into the variable. However, when expression is the name of a column, it can return multiple values. If the SELECT statement returns more than one value, the variable is assigned the last value that is returned.

If the SELECT statement returns no rows, the variable retains its present value. If expression is a scalar subquery that returns no value, the variable is set to NULL.

One SELECT statement can initialize multiple local variables.