Answers for "declare row variable sql server"

SQL
0

declare row variable 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 ...
Posted by: Guest on March-22-2022

Code answers related to "declare row variable sql server"

Code answers related to "SQL"

Browse Popular Code Answers by Language