Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

select into question

0 views
Skip to first unread message

Keith G Hicks

unread,
Nov 19, 2009, 3:47:33 PM11/19/09
to
MS SQL 2000

I know I can do this:

SELECT FirstName, LastName INTO #Names FROM CustNames

and I know I can do this:

INSERT INTO #Names EXEC dbo.MyProc '02/05/2009', 0
(where #Names has been previously defined)

But can I do this?

SELECT FirstName, LastName INTO #Names EXEC dbo.MyProc '02/05/2009', 0

I want to select the return values of a procedure into a new table that I
haven't previously defined.

Thanks,

Keith


Gert-Jan Strik

unread,
Nov 19, 2009, 4:58:29 PM11/19/09
to
AFAIK that is not possible.

It might have something to do with the fact that stored procedures are
not deterministic. The returned data structure is not known until the SP
is called. In fact, it might depend on some logic within the SP.

--
Gert-Jan
SQL Server MVP

--CELKO--

unread,
Nov 19, 2009, 6:17:39 PM11/19/09
to
>> I want to select the return values of a procedure into a new table that I haven't previously defined. <<

The MOST BASIC assumption of RDBMS is that you know the nature of the
"Universe of Discourse" when you are in SQL. A table is a set of
things of the same kind or a relationship. Everything is defined.

Creating a new table on the fly is like making dinosaurs appear out of
thin air in the middle of a romantic comedy.

It is more than just getting a feature in one product wrong, like
Strik told you; you are getting foundations wrong and writing crappy
code.

Keith G Hicks

unread,
Nov 19, 2009, 7:09:59 PM11/19/09
to

I've seen that movie. It's called "Land of the Lost". It was funny. So are
you.

"--CELKO--" <jcel...@earthlink.net> wrote in message
news:a976aed6-70cb-4fef...@p35g2000yqh.googlegroups.com...

Keith G Hicks

unread,
Nov 20, 2009, 9:47:37 AM11/20/09
to
Thanks for the info. I had a feeling that was the reason.

"Gert-Jan Strik" <sorrytoomuc...@xs4all.nl> wrote in message
news:4B05BF85...@xs4all.nl...

0 new messages