TABLE Variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SAM

    TABLE Variables

    Hey everyone,

    I read in a SQL Server book that you can now create a table
    variable.

    DECLARE @TMP TABLE (list of fields)

    Then you can you can use the statement

    INSERT INTO @TMP
    SELECT (whatever).

    I've tried it and it works. The book also says that you
    should be able to pass these variables between stored
    procedures and functions. Problem is, when I try to
    declare the variable at the top of the procedure, the
    syntax checker hates it.

    Anyone else out there try this out?

    SAM
  • Anith Sen

    #2
    Re: TABLE Variables

    Actually you cannot use a table variable as a parameter for stored
    procedures or functions. This is documented under the topic CREATE PROCEDURE
    in SQL Server Books Online.

    To share data across stored procedures you can find some approaches here at:


    --
    - Anith
    ( Please reply to newsgroups only )


    Comment

    Working...