Answer: With SQL Server 2005, we need to declare and initialize variables individually.
declare @t1 int,
@t2 varchar(10)
set @t1 = 4
set @t2 = 'Hello!'
print @t1
print @t2
But with SQL 2008, we can do it following way:
declare @t1 int = 4,
@t2 varchar(10)= 'Hello!'
print @t1
print @t2
Asked In: Many Interviews |
Alert Moderator