SQL SERVER – 2008 – Two Convenient Features Inline Assignment – Inline Operations

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)

SQL Scripts, SQL Utility
Previous Post
SQL SERVER – Find Space Used For Any Particular Table
Next Post
SQL SERVER – 2008 – Introduction to SPARSE Columns

Related Posts

Leave a Reply