Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 assign the data of column to a variable

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2011-07-18 : 16:12:42
I have a table customer with following field:

time slot with data being like this:
6-8
7-9
8-9

i wnat to assign this column to variable

so that when i select @variable i should get the result set as
6-8
7-9
8-9


Thank you

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-07-18 : 16:58:20
you mean this?

declare @t table (timeslot varchar(10))
insert @t (timeslot)
select timeslot from [customer]



Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -