February 18, 2004 at 4:25 pm
I have a stored proc that returns a resultset. I would like to call that proc from another proc inserting the results into a temp table. The code I'm using is below. Is there another way to do this without creating the structure for #t? Sort of like a SELECT INTO.
create table #t (Cusip char(20),
SecPrice float,
CurFactor float,
PrevFactor float,
CurCoupon float,
PrevCoupon float,
CurAccrDate datetime,
PrevAccrDate datetime,
USDRate float,
DolsPerPt float)
--exec spCurrentInfoAsOfDate @AsOfDate
insert #t exec spCurrentInfoAsOfDate @AsOfDate
February 18, 2004 at 4:59 pm
February 19, 2004 at 11:23 am
I have not been able to do this without creating the table ahead of time.
Curtis Smith
SQL Server DBA
Well in worked in Theory ...
February 19, 2004 at 11:53 am
If you want to do this you can convert your SP to a UDF that returns a table. You will then be able to do something like the following
SELECT * into #Foo
FROM dbo.MyUDF(@Param)
SELECT * FROM #Foo
Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer
This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.
February 19, 2004 at 11:56 am
if you follow the udf path you may as well don't create the table at all
just use:
SELECT * FROM dbo.MyUDF(@Param)
* Noel
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply