Link to home
Start Free TrialLog in
Avatar of pvsbandi
pvsbandiFlag for United States of America

asked on

Populate a Temporary Table

Hi,
 iam new to Sybase.
 I have a stored procedure,which returns a data set.I'd like to dump the results of this stored procedure,into a temporary table.
  How can i do that?
Thanks.
Avatar of pvsbandi
pvsbandi
Flag of United States of America image

ASKER

Hello!!...nobody to clear my doubt?
ASKER CERTIFIED SOLUTION
Avatar of Joe Woodhouse
Joe Woodhouse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
 Thanks for the reply..iam on ASE 12.5.
  As you said,the first method asks for a structure of a table to be created first,in order to
  populate the data from the stored proc.
  Can you tel me another way,which will simply dump the data returned by the
  stored proc into a temporary table on the fly,without having to create the table.
Thanks1
 
Avatar of Joe Woodhouse
Joe Woodhouse

Any temp table that you create in the stored proc does not exist outside the scope of that proc. When the proc finishes executing, then the table is gone.

You could go with my first suggestion and have the first result set in the proc do a SELECT INTO, and all subsequent SELECTs do an INSERT... SELECT. You can use a "persistent" table in tempdb, which unlike #temp tables *will* be visible when the proc is finished...