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
 SQL Server Development (2000)
 Selecting data into new table from stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-20 : 07:49:44
Ramu writes "Hai all,

Can you guys have idea how to

create a table from a stored procedure.
Like for eg

select * into newtable from ... STORED PROCEDURE


Thanks,

Ramu"

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-04-20 : 07:51:02
you must be looking for function (udf)

--------------------
keeping it simple...
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-04-20 : 09:35:36
You can't "select into" from an SP.

However, you can create a table with the same structure as the SP output and insert.
ie:
insert myTable(<return col list from sp>) exec mySP

Or what jen was saying, you can create a "table" function which is a user defined function that returns "table" rather than a single value and treat it just like you would a table.
ie:
select * into myNewTable from dbo.myUDF

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -