Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Multiple values in stored proc parameter

Multiple values in stored proc parameter

Scheduled Pinned Locked Moved Database
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GaryWoodfine
    wrote on last edited by
    #1

    Hi Guys, I need a hand with the following. I need to write a stored proc that accepts a parameter that contain multiple values. i.e alter proc spGetLastNames @Firstnames varchar(200) as Select lastname from user where firstname in(@Names) @Firstnames should be able to accept a comma delimited string i.e 'Frank', 'Peter', 'William' I am pondering whether to use XML to pass the Parameters, do you think this would be viable?

    Kind Regards, Gary


    My Website || My Blog || My Articles

    M 1 Reply Last reply
    0
    • G GaryWoodfine

      Hi Guys, I need a hand with the following. I need to write a stored proc that accepts a parameter that contain multiple values. i.e alter proc spGetLastNames @Firstnames varchar(200) as Select lastname from user where firstname in(@Names) @Firstnames should be able to accept a comma delimited string i.e 'Frank', 'Peter', 'William' I am pondering whether to use XML to pass the Parameters, do you think this would be viable?

      Kind Regards, Gary


      My Website || My Blog || My Articles

      M Offline
      M Offline
      Mark J Miller
      wrote on last edited by
      #2

      See my article on parameterizing IN http://www.codeproject.com/cs/database/TableValuedFnsAsArrays.asp[^]

      G 1 Reply Last reply
      0
      • M Mark J Miller

        See my article on parameterizing IN http://www.codeproject.com/cs/database/TableValuedFnsAsArrays.asp[^]

        G Offline
        G Offline
        GaryWoodfine
        wrote on last edited by
        #3

        thanks ! just what I needed

        Kind Regards, Gary


        My Website || My Blog || My Articles

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups