Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using SET versus SELECT

Posted on 2001-06-25
6
Medium Priority
?
266 Views
Last Modified: 2008-02-20
What is the difference?  Is either way better?  Any tips?
0
Comment
Question by:svfafel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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 143

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

662 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