In SQL Server 2008 onwards, the DECLARE statement has been enhanced to support the declaration and
initialization of variables in one statement.
Now we can initialize values for most data types. The following code example shows how
to declare and initialize a variable.
declare @test_var int =10 print @test_var
In the above example, we have declared variable named @test_var and also assigned value to that variable in first line. This was the enhancement, this code will not work in SQL Server 2005 and lower versions.
Long Data type like TEXT, NTEXT, and IMAGE still can not be declared and initialized in one statement.