For instance, while looping when we need to increment counter, in earlier version we used to set the the counter=Counter+1 kind of code. But new assignment operator will make assignment more simple (may be less readable). This may be useful in Join
SQL 2005/ 2000 way of Assigning .
Declare @Counter int
Set @Counter =1
While @Counter <10
Begin
Print @Counter
Set @Counter =@Counter +1
End
SQL 2008 way of Assigning .
Declare @Counter int=1
While @Counter <10
Begin
Print @Counter
Set @Counter +=1
End
Basically, in earlier versions, equal sign (=) was the only Transact-SQL assignment operator. Now in 2008 you have += , -=, *=, /=
Wednesday, February 13, 2008
Subscribe to:
Post Comments (Atom)

1 comment:
I have been visiting various blogs for my research papers writing. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards
Post a Comment