Checking id of Comma seperated names in single stored procedure

  • Hi i have a query,

    i want to pass comma separated names to stored procedure

    where in stored procedure the name should be separated (which could be done by Function),then check table to get Id of that particular name in TableB and then insert it into tableC all to be done in single stored procedure as this is just one part of stored procedure.

    how should be go about it

  • if ur using sql server 2008 , you should try using table data type , in which you can now pass a array as the input to the proc and then have it join with other tables internally.

    If you do not have sql 2008 , use a recursive cte to split the string the the beginging of the proc .

    http://www.sqlservercentral.com/articles/Tally+Table/72993/

    Jayanth Kurup[/url]

  • is it possible to use table variable as a

    input parameter for another query

  • I am not sure if your confusing a user defined table data type with a table variable . They are two different things.

    A table variable can be reused within the same batch so you can use it as the "input" for another query, but not as a input to a procedure. If you want to pass a array as input to a proc then use a TABLE Data type

    Jayanth Kurup[/url]

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

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