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 2005 Forums
 Transact-SQL (2005)
 Store query result in array

Author  Topic 

shantanu88d
Starting Member

35 Posts

Posted - 2011-03-14 : 06:28:51
Is there any way to store results of a query directly into an array in sql server 2005??

e.g I want to do something like this
declare @var as varchar(500)
@var = select * from anytable

is this possible?

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-03-14 : 07:12:10
No. But you can declare @var as a table variable and insert into it

INSERT INTO @var
SELECT <columns> fron anyTable.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

shantanu88d
Starting Member

35 Posts

Posted - 2011-03-14 : 08:03:23
Hey, thanks for that. Tried it already and worked !! Thank you
Go to Top of Page
   

- Advertisement -