Declare a variável de linha SQL Server
-- FIRST OF ALL , get the types of columns
SELECT
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH AS MAX_LENGTH,
CHARACTER_OCTET_LENGTH AS OCTET_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'table_name'
AND COLUMN_NAME = 'column_name';
-- make sure that types are the same
DECLARE @a type , @b type , @c type
-- make sure of the sort
SELECT a,b,c into @a , @b , @c FROM table WHERE conditions ..
--BONUS
-- if table has the same columns that you declared then you can use :
-- SELECT * INTO @a,@b,@c ...
otmane smiri