Thursday, July 5, 2012

Inline variable Assignment Process in Microsoft Sql Server 2008


Inline variable assignment in SQL Server 2008 enables to – declare, and assign the variables in a ‘single line’.

For example :

In Traditional Way :

DECLARE @myVar int
SET @myVar = 5
need to declare the variable and assigning it to the variable to split into 2 
lines and use 2 statements - DECLARE and SET.

In SQL Server 2008, as the name suggests ‘inline’, both declaration and assignment can be given in a single line:

DECLARE @myVar int = 5

No comments:

Post a Comment