In SQL Server 2008, when you define a variable with “Declare”, you can also assign data to that variable in the same row! We could not do this in earlier versions of SQL Server. However, after defining the variable, we were able to assign data to the variable using the “SET” command on another line.
So how do we do this in SQL Server 2008?
For example:
1 | Declare @Country_Count INT = (SELECT Count(*) FROM [dbo].[Country]) |