Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a table with store procedure results

Status
Not open for further replies.

LonnieJohnson

Programmer
Joined
Apr 16, 2001
Messages
2,628
Location
US
Can this be done? I have a stored procedure that has a union query sql. I have it in a sproc because it runs much faster there. I would like to take the result set and create a table. Is that possible?

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
No, but you can do something like the following:

Code:
CREATE TABLE #SomeTable (
SomeColumn INT,
SomeColumn2 VARCHAR(30))

INSERT INTO #SomeTable EXEC SomeProc
 
Thanks. I actually ended up putting the sql in a view and putting the make a table sql in a stored procedure using the view as the data source. it runs just as fast.

That way if I need to add or remove fields, then I only do it in one place.

Thanks again.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top