August 3, 2005 at 8:08 pm
Hi,
I need to execute an SP and then get the result put into a temporary table (so I can do some work on the data depending upon some other variables). It sounds simple enough and I'm guessing its possible but I can find the right syntax to get it to work.
So can anyone give me the systax that will work?
This is a call to my SP that works:
EXEC apBL_Schedule_Select 20284, 'AS', 0
Thanks in advance,
Chiz.
August 3, 2005 at 8:51 pm
assuming that the table is already created :
insert into #TempTable (col1, col2...) EXEC apBL_Schedule_Select 20284, 'AS', 0
August 3, 2005 at 9:05 pm
Thanks Remi.
Is there a way to do it so I don't have to manually (in code) define the temporary table?
August 3, 2005 at 9:59 pm
The same question have been asked today (not answered yet). It's surely possible to do it. But unless it's what your application revolves around and that you have users who can create sps and need to manipulate the results in temp table... I don't see any reason to go through that trouble. The simplest would really be to create the temp table manually when needed, it'll take much less time in the long run.
August 3, 2005 at 10:06 pm
Or you could wrap the entire process in your stored procedure - by selecting the results of your sp into a temp table and then querying the temp table ?!?! like...
create procedure procTemp
as
select *
into #temp
from....whatever the sp is doing right now...
**ASCII stupid question, get a stupid ANSI !!!**
August 3, 2005 at 10:11 pm
That gave me an idea...
Select * into NewTable from Openrowset (linkedserverinfo, 'Exec procedure...')
Now I would literally call this nasty, cheating, wrong... but that would work .
August 5, 2005 at 6:55 am
Nope - no noeld - but now that you have the union thing going with him remi you can pm him and ask...
meanwhile - for Ian - here's the link to the other post with the same question
remi - the highest compliment that I can pay you is that "it is indeed going to be an union of 2 GREAT minds" when the happy day finally arrives....
**ASCII stupid question, get a stupid ANSI !!!**
August 5, 2005 at 7:25 am
Dream on... he still didn't give me the ring...
Anyways I ave already asked him to check the thread out. He must be busy at work... for once this week .
August 5, 2005 at 7:40 am
actually for the very first time last night - i saw him online quite late...maybe he's sleeping in this morning ?!?!
so you're oldfashioned remi - waiting for a ring ?!?!
**ASCII stupid question, get a stupid ANSI !!!**
August 5, 2005 at 8:17 am
Yeah I had to work late (on a personal project yesterday) and took a break to hop in for some break 😉 And you were online too!!!
I don't really like working late nights but in this bussiness you have clients and deadlines
I've been lazy lately
BTW: I replied to your post on the other thread
* Noel
August 5, 2005 at 8:26 am
Yup... can't get married without a ring.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply