Array as a parameter to stored procedure.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Array as a parameter to stored procedure.

  1. #1
    Ellen Khlystova Guest

    Array as a parameter to stored procedure.

    Is it possible to accept an array ( or any data structure representing
    an ordered set ) as an input parameter in a stored procedure? The
    number of elements will vary from call to call.

    DB: MS SQL 7 on NT

    Thanks.
    Ellen.



  2. #2
    Phil Kerkel Guest

    Re: Array as a parameter to stored procedure.


    No, SQL Server does not support any array parameters.

    The only workaround I know of is to pass a delimited string of values into
    a stored procedure, create a #temp table, then inside of a while loop parse
    the values into the temp table.

    Ellen Khlystova <ekhlystova@ksminc.com> wrote:
    >Is it possible to accept an array ( or any data structure representing
    >an ordered set ) as an input parameter in a stored procedure? The
    >number of elements will vary from call to call.
    >
    >DB: MS SQL 7 on NT
    >
    > Thanks.
    > Ellen.
    >
    >



  3. #3
    Phil Kerkel Guest

    Re: Array as a parameter to stored procedure.


    No, SQL Server does not support any array parameters.

    The only workaround I know of is to pass a delimited string of values into
    a stored procedure, create a #temp table, then inside of a while loop parse
    the values into the temp table.

    - Phil

    Ellen Khlystova <ekhlystova@ksminc.com> wrote:
    Is it possible to accept an array ( or any data structure representing an
    ordered set ) as an input parameter in a stored procedure? The number of
    elements will vary from call to call.

    DB: MS SQL 7 on NT

    Thanks.
    Ellen.

  4. #4
    Ellen Khlystova Guest

    Re: Array as a parameter to stored procedure.

    Phil,
    Thanks for the prompt reply.

    I already parse a NVARCHAR ( 511 ) string, but this is not an "elegant"
    solution...


    Ellen.


  5. #5
    DaveSatz Guest

    Re: Array as a parameter to stored procedure.

    check out http://www.mssqlserver.com/faq/development-array.asp

    "Ellen Khlystova" <ekhlystova@ksminc.com> wrote in message
    news:3A6F3EDF.17E0F8E6@ksminc.com...
    > Is it possible to accept an array ( or any data structure representing
    > an ordered set ) as an input parameter in a stored procedure? The
    > number of elements will vary from call to call.
    >
    > DB: MS SQL 7 on NT
    >
    > Thanks.
    > Ellen.
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center