Re: Inserting into a TempDB table via a stored Proc
From: Ross Presser (rpresser_at_imtek.com)
Date: 12/21/04
- Next message: --CELKO--: "Re: Batch with cursor successful, but not really"
- Previous message: Ross Presser: "Re: Need help in avoiding cursors"
- In reply to: NonNB: "Inserting into a TempDB table via a stored Proc"
- Next in thread: NonNB: "Re: Inserting into a TempDB table via a stored Proc"
- Reply: NonNB: "Re: Inserting into a TempDB table via a stored Proc"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 21 Dec 2004 12:41:02 -0500
On 21 Dec 2004 05:49:33 -0800, NonNB wrote:
> Hi
>
> Is there a way in MS SQL 2000 to insert the results of a Sproc into a
> #temp table without having to create it up front ?
>
> e.g. instead of
> Create table #tmp(ID INT)
>
> insert into #tmp
> exec dbo.myProc
>
> (where dbo.myProc returns several rows of a single INT field)
>
> do something like
>
> select "exec dbo.myProc"
> into #tmp
>
> i.e. so don't have to go through the motions of manually creating the
> Temp table??
>
> Thanks in Advance
>
> Stuart
No, there is not.
If it's a big annoyance, you could always wrap the table creation + call
into another stored procedure:
CREATE PROCEDURE CallAndInsert ()
AS
CREATE TABLE #tmp(ID INT)
INSERT INTO #tmp
EXEC dbo.myProc
- Next message: --CELKO--: "Re: Batch with cursor successful, but not really"
- Previous message: Ross Presser: "Re: Need help in avoiding cursors"
- In reply to: NonNB: "Inserting into a TempDB table via a stored Proc"
- Next in thread: NonNB: "Re: Inserting into a TempDB table via a stored Proc"
- Reply: NonNB: "Re: Inserting into a TempDB table via a stored Proc"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|