Tuesday, 27 September 2016

How declare table variable in sql


Declare a table variable
DECLARE @t table
( 
    id        INT Identity, 
    column1   VARCHAR(200)
)

insert value to the table 
insert into @t(a)
     select 'aa'
     union
     select 'bb'
     union
     select 'cc'
     union
     select 'dd'

Run select query
select * from @t
 
 
1       aa
2       bb
3       cc
4       dd 

No comments:

Post a Comment

Interactive CSS Button Designer Tool – Free & Fast

What is Button ?                               Button  is an element of HTML. HTML is used to design Web Page and Website and Web applicatio...