Array in Store procedure

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Song

    Array in Store procedure

    Dear all,

    Sometimes I happened the require that the number of input parameters
    of SP is not fixed, Can sql T-SQL handle the array (dynamic array)?
    Does anybody ever used an array name as the input parameter to call
    the SP?

    thanks,

    Robert
  • David Portas

    #2
    Re: Array in Store procedure

    SQL doesn't have arrays but see this article for some alternatives:



    --
    David Portas
    SQL Server MVP
    --


    Comment

    • Federico Fissore

      #3
      Re: Array in Store procedure

      Robert Song wrote:
      [color=blue]
      > Dear all,
      >
      > Sometimes I happened the require that the number of input parameters
      > of SP is not fixed, Can sql T-SQL handle the array (dynamic array)?
      > Does anybody ever used an array name as the input parameter to call
      > the SP?
      >
      > thanks,
      >
      > Robert[/color]
      I had this problem a year ago and solved it using a udf named fn_Split
      I found it pretty fast.
      You give it a list of parameters as '1,2,3,4,5,6' and it returns a temp
      table
      so you can select from fn_Split() and have something like
      1
      2
      3
      4
      5
      6

      i found a version of this udf at


      hth

      f.

      Comment

      • robert song

        #4
        Re: Array in Store procedure

        Hi David,

        Thank you so much for your reply, i will read the article later on.

        Cheers,

        Robert Song

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        Working...