Sometimes things just go very convenient and we wish that how come it was not available in earlier versions.
Let us see two features here. If it was SQL Server earlier versions we might have to write more lines to achieve what we can achieve in lesser lines. Following small example with only one variable demonstrates this feature.
SQL Server 2005 version:
DECLARE @idx INT
SET @idx = 0
SET @idx = @idx + 1
SELECT @idx
GO
SQL Server 2008 version:
This version demonstrates two important feature of Inline Assignment and Inline Operations
DECLARE @idx INTÂ = 0
SET @idx+=1
SELECT @idx
GO
Reference : Pinal Dave (https://blog.sqlauthority.com)
6 Comments. Leave new
Are you sure you don’t have these mixed up? The 2008 version has MORE lines than the 2005 version.
Code pasted into wrong sections?
Good blog, Pinal Dave!
I think your example labels are backwards… the 2005 version is the new 2008 syntax, isn’t it?
You labels are wrong, top one is 2008, bottom one is 2005.
Pinal,
This is a very impressive site. congratulations.
i appreciate if you can answer this question. the key is code and city. i am on sql server 2005.
code city test
132 bangalore test1
132 chennai test2
i want the data in one row
132 bangalore chennai test1 test2
please help!