• SanjayAttray (6/24/2010)


    Even though I got it right and know its possible but when executed in SSMS 2005 it returned error.

    Msg 139, Level 15, State 1, Line 0

    Cannot assign a default value to a local variable.

    Msg 139, Level 15, State 1, Line 0

    Cannot assign a default value to a local variable.

    Msg 137, Level 15, State 2, Line 3

    Must declare the scalar variable "@a".

    Code provided in the question is using SQL Server 2008 syntax, that's why it didn't work for you in SQL Server 2005 SSMS.