August 18, 2004 at 4:52 am
Hi
I am Wrting a StoredProcedure ,But i use this stored procedures output into a temp table for using this output into another Storedprocedure,
August 18, 2004 at 4:58 am
If you are going to have another SP use the data from this SP's temp table then you need to use ##tablename and not #tablename. The ## is available for anyone and the # is only available to the CURRENT SP. OR... you could dump the data into a REAL table created in tempdb and then DROP it afterwards.. Just a couple of different approachs
Good Hunting!
AJ Ahrens
webmaster@kritter.net
August 18, 2004 at 5:13 am
Ok
But i Use This Command It shows Error
What command i use for this
exec <storedprocedure name> #temptablename
select * into #temptablename from <storedprocedure name>
both commands are failed to process
August 18, 2004 at 5:21 am
try the following
1. Build the ##temptable information or real table with data inside the 1st sp
2. Call the 2nd sp that uses the table from sp 1
EXEC sp1
EXEC sp2
Good Hunting!
AJ Ahrens
webmaster@kritter.net
August 18, 2004 at 5:27 am
Ok Is it Possible to Store The Output of Sp into Pernment table
August 18, 2004 at 5:52 am
Yes,
Insert [#][#]Table Exec Proc
BUT, the table must already exist and have the same structure as the output of the Proc.
/rockmoose
You must unlearn what You have learnt
August 18, 2004 at 5:59 am
Try this:
Insert #temptablename
exec <storedprocedure name>
This will fill your temptable with results from the sp
Anders Dæmroen
epsilon.no
August 18, 2004 at 6:04 am
Yes, but the table must already exist..
So you have to create it prior to: insert <table> exec <proc>
/rockmoose
You must unlearn what You have learnt
August 18, 2004 at 7:15 am
Hi Thanks its Working
But i have to create the #Temp table Structure externally what o/p used in the sp i have used.
its not create the temp table dynamically while executing the sp
August 18, 2004 at 7:43 am
Why do you have to create the #Temp table Structure externally?
What are You trying to accomplish?
/rockmoose
You must unlearn what You have learnt
August 19, 2004 at 1:18 am
insert #freebaltb EXEC GET_IVRSCRIPWISEBALANCE 888888888
i am executing this query i m getting this kind of error
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name '#freebaltb'.
can u tell me wht is the reason
August 19, 2004 at 1:25 am
You would have to do:
create table #freebaltb( ... table definition here ... )
insert #freebaltb EXEC GET_IVRSCRIPWISEBALANCE 888888888
/rockmoose
You must unlearn what You have learnt
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply