Using a table variable as input parameter for stored proc

  • Basically, can you do this?

    BOL states that any data type but a cursor can be used as an input parameter.  I tried using the following different syntaxes:

    @mytable TABLE

    @mytable TABLE ()

    @mytable TABLE (field1 int)

    But I can't compile.  If anyone knows how/if this can be done, I would be VERY much abliged.

    Thanks.

    Steve Kumbsky

  • Unfortunately not. From the BOL entry for CREATE PROCEDURE:

    ...All data types, except the table data type, can be used as a parameter for a stored procedure. However, the cursor data type can be used only on OUTPUT parameters...

  • Thanks for the reply. I believe you. However, my version of BOL does not state that anywhere in the CREATE PROCEDURE topics. Regardless, it doesn't work.

     

    Steve Kumbsky

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply