Solved

Using SET versus SELECT

Posted on 2001-06-25
6
209 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

757 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

17 Experts available now in Live!

Get 1:1 Help Now