Passing table into stored procedure

  • Hello everyone,

    I can pass a table variable into a stored procedure that has a table variable as a parameter. Is is possible to do the same from VB.NET 2005?

    So for example, In my VB app, I have a datatable object filled with data. I want to pass this into my store procedure for processing. Can this be done?

    Thanks,

    Strick

  • stricknyn (2/21/2008)


    I can pass a table variable into a stored procedure that has a table variable as a parameter.

    You can? And it works? Would you mind showing us how? Lots of folks will sure be interested in this one... seriously!

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • "Table-valued parameters are a new parameter type in SQL Server 2008. Table-valued parameters are declared by using user-defined table types. You can use table-valued parameters to send multiple rows of data to a Transact-SQL statement or a routine, such as a stored procedure or function, without creating a temporary table or many parameters."

    http://msdn2.microsoft.com/en-us/library/bb510489(SQL.100).aspx

  • You cannot pass a table variable into a stored procedure using SQL Server 2005 (that I am aware of); however, this feature is available in SQL Server 2008.

    article

    http://www.sqlservercentral.com/articles/News/3182/

  • Yeah... I know, I know... thanks guys...

    Sticknyn... don't let them scare you off, Man... if you know a way to pass a table variable in 2k5, you've just gotta tell us. Not making fun of you, either. This would be some serious good poop if you really know how to pass a table variable to a proc in 2k5. Please, if it's not a mistaken claim, tell us how to do it. If it is a mistaken claim, no problem... tell us it was a mistake and no harm done but we gotta know.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 1 through 4 (of 4 total)

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