<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-495177919198719500.post1860420345574171880..comments</id><updated>2010-06-23T23:06:10.082-07:00</updated><category term='Integration Services SSIS'/><category term='SQL Azure'/><category term='Link List'/><category term='SQL Data Services'/><category term='Transact SQL T-SQL'/><category term='SQL Server Training'/><category term='Business Intelligence'/><category term='SQL Server Administration'/><category term='SQL Server Denali'/><category term='Analysis Services SSAS'/><category term='Reporting Services SSRS'/><category term='SQL Server General'/><title type='text'>Comments on Microsoft Sql Server Tutorials: SET VS SELECT - When to use what?</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.sqlservercurry.com/feeds/1860420345574171880/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default'/><link rel='alternate' type='text/html' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html'/><author><name>Suprotim Agarwal</name><uri>http://www.blogger.com/profile/08349831623922214390</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_0j4bzarlOBg/TEefNfVYJBI/AAAAAAAABOE/GoGXFIVogfU/S220/Supmvp.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-495177919198719500.post-1258445853863855813</id><published>2010-06-23T23:06:09.845-07:00</published><updated>2010-06-23T23:06:09.845-07:00</updated><title type='text'>SET @CID =(Select CID from Customers)
SELECT @CID ...</title><content type='html'>SET @CID =(Select CID from Customers)&lt;br /&gt;SELECT @CID = (Select CID from Customers)&lt;br /&gt;Both of these statements will fail if there are multiple rows in the result.&lt;br /&gt;&lt;br /&gt;Following is the actual syntax if query returns multiple results&lt;br /&gt;&lt;b&gt;&lt;br /&gt;SELECT @CID = CID from Customers&lt;br /&gt;&lt;/b&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/1258445853863855813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/1258445853863855813'/><link rel='alternate' type='text/html' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html?showComment=1277359569845#c1258445853863855813' title=''/><author><name>Deepak</name><uri>http://www.blogger.com/profile/16797048409762058572</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html' ref='tag:blogger.com,1999:blog-495177919198719500.post-1860420345574171880' source='http://www.blogger.com/feeds/495177919198719500/posts/default/1860420345574171880' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-721343325'/></entry><entry><id>tag:blogger.com,1999:blog-495177919198719500.post-4272615237920166769</id><published>2010-04-12T07:35:39.822-07:00</published><updated>2010-04-12T07:35:39.822-07:00</updated><title type='text'>Actually,
SET @CID =(Select CID from Customers)
SE...</title><content type='html'>Actually,&lt;br /&gt;SET @CID =(Select CID from Customers)&lt;br /&gt;SELECT @CID = (Select CID from Customers)&lt;br /&gt;will behave identically - both will fail for multiple rows.&lt;br /&gt;&lt;br /&gt;SELECT will behave as you described when you don&amp;#39;t use a subquery (i.e. SELECT @CID = CID from Customers)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/4272615237920166769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/4272615237920166769'/><link rel='alternate' type='text/html' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html?showComment=1271082939822#c4272615237920166769' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html' ref='tag:blogger.com,1999:blog-495177919198719500.post-1860420345574171880' source='http://www.blogger.com/feeds/495177919198719500/posts/default/1860420345574171880' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-39663550'/></entry><entry><id>tag:blogger.com,1999:blog-495177919198719500.post-1845849449197845092</id><published>2008-04-27T11:02:00.000-07:00</published><updated>2008-04-27T11:02:00.000-07:00</updated><title type='text'>Thanks Boyan and Bart for the informative comments...</title><content type='html'>Thanks Boyan and Bart for the informative comments..</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/1845849449197845092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/1845849449197845092'/><link rel='alternate' type='text/html' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html?showComment=1209319320000#c1845849449197845092' title=''/><author><name>Suprotim Agarwal</name><uri>http://www.blogger.com/profile/08349831623922214390</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html' ref='tag:blogger.com,1999:blog-495177919198719500.post-1860420345574171880' source='http://www.blogger.com/feeds/495177919198719500/posts/default/1860420345574171880' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1944554914'/></entry><entry><id>tag:blogger.com,1999:blog-495177919198719500.post-1739341377545210690</id><published>2008-04-27T08:58:00.000-07:00</published><updated>2008-04-27T08:58:00.000-07:00</updated><title type='text'>Multiple assignments is by far the biggest reason ...</title><content type='html'>Multiple assignments is by far the biggest reason to use select over set.  It gives you a huge performance gain if you are setting a lot of variables for a big sproc/script&lt;BR/&gt;&lt;BR/&gt;declare @test int, @test2 int;&lt;BR/&gt;set @test = 1, @test2 = 2; --doesn't work&lt;BR/&gt;select @test = 1, @test2 = 2; -- works</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/1739341377545210690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/1739341377545210690'/><link rel='alternate' type='text/html' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html?showComment=1209311880000#c1739341377545210690' title=''/><author><name>Bart Czernicki</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html' ref='tag:blogger.com,1999:blog-495177919198719500.post-1860420345574171880' source='http://www.blogger.com/feeds/495177919198719500/posts/default/1860420345574171880' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1223383040'/></entry><entry><id>tag:blogger.com,1999:blog-495177919198719500.post-6569029901683189216</id><published>2008-04-25T05:49:00.000-07:00</published><updated>2008-04-25T05:49:00.000-07:00</updated><title type='text'>A shorter variation of:&lt;br&gt;SELECT @CID = (Select C...</title><content type='html'>A shorter variation of:&lt;BR/&gt;SELECT @CID = (Select CID from Customers)&lt;BR/&gt;is&lt;BR/&gt;SELECT @CID = CID from Customers</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/6569029901683189216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/495177919198719500/1860420345574171880/comments/default/6569029901683189216'/><link rel='alternate' type='text/html' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html?showComment=1209127740000#c6569029901683189216' title=''/><author><name>Boyan Kostadinov</name><uri>http://www.blogger.com/profile/01361725622852028759</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sqlservercurry.com/2008/04/set-vs-select-when-to-use-what.html' ref='tag:blogger.com,1999:blog-495177919198719500.post-1860420345574171880' source='http://www.blogger.com/feeds/495177919198719500/posts/default/1860420345574171880' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1116430830'/></entry></feed>
