Insert into Table_variable - UDF vs. SP behavior?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Wael Fadel (wael_fadel_at_hotmail.com)
Date: 07/01/04


Date: Thu, 1 Jul 2004 16:15:24 -0700

Hello,

I am wondering if MS is planning to change the behavior of UDFs vs. SP when
it comes to inserting into table variables?

A colleague and I were working on changing temp table inserts into
table_variable inserts when we hit came across the documented:

table variables may not be used in the following statements:
INSERT INTO table_variable EXEC stored_procedure

SELECT select_list INTO table_variable statements

We were able to bypass that by creating a UDF and then use this syntax

Insert into Table_Variable select * from dbo.UDF

Why don't the previous statements work? What is the scope of the table
variable right after creation? If this is by design what is the benefit
gained by it?

I ask because to my mind it is more efficient when inserting from an SP vs.
UDF.

Thanks,

Wael (Will) Fadel

DBA



Relevant Pages

  • Re: Insert into Table_variable - UDF vs. SP behavior?
    ... Wael Fadel wrote: ... >I am wondering if MS is planning to change the behavior of UDFs vs. SP when ... What is the scope of the table ... >I ask because to my mind it is more efficient when inserting from an SP vs. ...
    (microsoft.public.sqlserver.server)
  • Re: finding the middle of a linked list in one iteration
    ... My colleague has solved this impossible problem, ... exercise from Data Structures and Algorithms by Aho, ... does not seem to make any sense to me, I am programming from 1 year and my ... Inserting an element at a given position in a list is practical. ...
    (comp.programming)
  • Re: US Must Claim The Moon!
    ... unless the Chinese are planning on inserting a probe. ...
    (sci.space.history)