top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is the difference between SET and SELECT?

+2 votes
53 views

Hai, friends any say about the difference between SET and SELECT

posted Nov 14, 2014 by Balu

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Both SET and SELECT can be used to assign values to variables. It is recommended that SET @local_variable be used for variable assignment rather than SELECT @local_variable.

Examples
declare @i int
set @i=1
This is used to assign constant values.

select @i=max(column_name)from table_name
for ex.
select @i=max(emp_id) from table_emp.

answer Nov 14, 2014 by Manikandan J
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...