Solved

Using SET versus SELECT

Posted on 2001-06-25
6
220 Views
Last Modified: 2008-02-20
What is the difference?  Is either way better?  Any tips?
0
Comment
Question by:svfafel
6 Comments
 
LVL 18

Expert Comment

by:nigelrivett
ID: 6225522
Microsoft advise set as ansii standard but there isn't much difference (except learning to type two different words).
0
 
LVL 3

Expert Comment

by:mgmanoj
ID: 6225661
Set is to assign the values to a variable or expressions to a variable & it does not displays the result in output while select displays in the result set it can be also used to assign.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
ID: 6226470
i agree with mgmanoj, especially if you have stored procedures with SELECT instead of SET, you might need to
use the SET NOCOUNT ON at the beginning of the stored procedure to avoid the "empty" recordsets...

CHeers
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 2

Expert Comment

by:ZhongYu
ID: 6226656
In the case of assignment, like set @test=1, you can use whichever you like. SET is ansi standard, its more clean to me. SELECT let you assign several values at the same time.
 

0
 

Author Comment

by:svfafel
ID: 6227561
Thank you to all!!! I wish i could give points to everyone....
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6227611
For mgmanoj:
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=mssql&qid=20141705

Sorry nigel, as you did only complain, no points today! (just joking)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now