Is there a way in T-SQL (SQL Server 2005) to assign a whole record to a record variable and then refer to the particular values using column names?
I mean, instead of:
select @var1 = col1,
@var2 = col2
from mytable
where ID = 1;
and referring to them as @var1 and @var2, something like
@record =
select col1, col2
from mytable
where ID = 1;
and referring to them like @record.col1 and @record.col2 .
I am beginner in t-sql, so hopefully the question is not too trivial.