I donβt know if I understand your problem. If you want to set several variables at once:
DECLARE @myInt INT; DECLARE @myDate DATETIME; SELECT @myInt = someInt, @myDate = someDate FROM someTable WHERE myName = someName
Also note that if a select selects many rows, the variables will contain the last row values. In fact, the variables will be set for each row selected.
Also note that in SQL Server you do not have a parameter for an Int declaration. Perhaps you want to use Decimal (20) .
source share