locked
User-Defined Table Types - nested RRS feed

  • Question

  • I have to call a stored procedure with following values.

    I planned to use Table valued parameters.

    I was thinking to use ID1 as one type and then declare another user defined table type with ID, ID1 in it, which is not allowed in SQL Server(nested user defined table type). If it does, I might be missing how to do it.


    What would be the good way to call stored procedure with flexible number of rows.


    ID ID1 dt1 dt2

    1   101

         102

         103..

    2     56

           57

           58...

    3

    ...

    Monday, June 10, 2013 7:05 PM

Answers

  • You already have the answer to the question you asked - a TVP.  Unfortunately, you confused the discussion with your initial statements about nested tables.  This suggests some desire to do something very different.   You specifically mentioned a flexible number of rows (which is an inherent property of a table), but your comments indicate you meant a flexible number of columns.  TSQL is strongly typed - attempting to pass randomly-structured data will be a challenge for experienced programmers. You may want to read the information on Erland's site for a discussion on TVP usage (and data-sharing in general).

    Erland - sharing data

    • Proposed as answer by Fanny Liu Wednesday, June 12, 2013 6:23 AM
    • Marked as answer by Fanny Liu Monday, June 17, 2013 1:30 AM
    Tuesday, June 11, 2013 2:11 PM