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 2000 Forums
 Transact-SQL (2000)
 Handle result set from stored procedure

Author  Topic 

Stoetti
Starting Member

2 Posts

Posted - 2005-02-15 : 13:43:34
Hey!

I need to work with the result set of a stored procedure. The stored procedure is called sp_helpuser and returns all users the current database.
I did not find any opportunity to get the result set into a TABLE object within Transact-SQL.

Any suggestions?


Stoetti

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-15 : 13:47:47
INSERT INTO SomeTable...
EXEC sp_helpuser...

Tara
Go to Top of Page

Stoetti
Starting Member

2 Posts

Posted - 2005-02-16 : 03:02:06
Thanks, that worked perfectly using a normal table.
But is there a way to get the rows into a table variable without using a temporary table?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-02-16 : 05:36:33

I think it is not possible

Madhivanan
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-16 : 05:50:06
no because you have to declare a temp table variable with known columns.
temp tables are the way to go here. and why not? they're good :)

Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-02-16 : 06:23:13

If you try, you will get the error

Server: Msg 197, Level 15, State 1, Line 3
EXECUTE cannot be used as a source when inserting into a table variable.

Madhivanan
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-16 : 12:44:47
You must use a temporary table or a "normal table".

Tara
Go to Top of Page
   

- Advertisement -