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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capturing partial results of sp into temp table

Status
Not open for further replies.

deb18

Programmer
May 19, 2003
40
US
I have a stored procedure "glbl1_sp" that returns a table (or is it called a recordset - it's done with a select statement) with a bunch of columns - let's call them columns "a" through "q". I need only columns "a" and "b" dumped into a temp table. I cannot access that stored procedure "glbl1_sp". I am currently doing the following:
Code:
create table ##nat_acc_tbl(account_code varchar (50), account_description varchar (2000), c varchar (200), d varchar (200), e varchar (200), f varchar (200), g varchar (200), h varchar (200), i varchar (200), j varchar (200), k varchar (200), l varchar (200), m varchar (200), n varchar (200), o varchar (200), p varchar (200), q varchar (200))
 
insert into ##nat_acc_tbl exec glbl1_sp
 
alter table ##nat_acc_tbl drop column c,d,e,f,g,h,i,j,k,l,m,n,o,p,q
...but have a strong feeling that this is a highly inefficient way to do this. Is there some way to simply do something like "select a,b into ##temp_table from stored_proc"?

Thanks!
Deb
 
I'm not sure of the complexity of your stored procedure, but if it's possible to create a View instead, this may address the problem.
 
Our accounting ERP mandates the use of the stored procedure.
 
Well I was going to suggest you write a new stored procedure based on the other one that only selected the fields you want. Other than that I see no more efficient way to do this.

Questions about posting. See faq183-874
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top