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

Dynamic creation of Temp table

Status
Not open for further replies.

rajpree

Programmer
May 24, 2005
18
0
0
US
Hi, I want create temp table on the fly but I am having following problem. Please advise if any one has an new ideas.

following sql is working fine, I want to explan want I am looking for:
begin
create table #temp1
(issue_id int,
issue_name varchar(50),
pass_thru_filter int,
ps_issue_id int,
PS_item_id int
)
Insert into #temp1(
pass_thru_filter,
ps_issue_id,
PS_item_id,
issue_id,
issue_name
)
exec PS_Display @ps_id=51,@ps_display_option= 'ISSU',@filter_exp_id= NULL,
@ps_layout_id= 51,@order_field= null,@order_direction=null,@display_summary=0

In this case PS_Display is stored procedure, has fixed in put parameters. And I can't modify stored Procedure. ps_layout_id= 51 has 5 columns for now but user can add more column to layout 51. In this case every time user adds columns developer need to change stored procedure. I wan to do some thing like below, which is not working at this time. Want to create Dynamic temp table.

begin
select *
into #temp2
from exec PS_Display @ps_id=51,@ps_display_option= 'ISSU',@filter_exp_id= NULL,@ps_layout_id= 51,@order_field= null,@order_direction=null,@display_summary=0
end

Thanks,
Raj.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top