Saturday, July 23, 2011

Compound Operators in SQL Server 2008


Compound operators execute some operation and set an original value to the result of the operation
Declare @temp tinyint
Select @temp = 1
Set @temp += @temp
print @temp
The following is a list of compound operators
Operator
Link to more information
Action
+=
+= (Add EQUALS) (Transact-SQL)
Adds some amount to the original value and sets the original value to the result.
-=
-= (Subtract EQUALS) (Transact-SQL)
Subtracts some amount from the original value and sets the original value to the result.
*=
*= (Multiply EQUALS) (Transact-SQL)
Multiplies by an amount and sets the original value to the result.
/=
/= (Divide EQUALS) (Transact-SQL)
Divides by an amount and sets the original value to the result.
%=
%= (Modulo EQUALS) (Transact-SQL)
Divides by an amount and sets the original value to the modulo.
&=
&= (Bitwise AND EQUALS) (Transact-SQL)
Performs a bitwise AND and sets the original value to the result.
^=
^= (Bitwise Exclusive OR EQUALS) (Transact-SQL)
Performs a bitwise exclusive OR and sets the original value to the result.
=
= (Bitwise OR EQUALS) (Transact-SQL)
Performs a bitwise OR and sets the original value to the result

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Deep's | Bloggerized by Deep - Deep's Templates | ElearSQL-Server