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. Stored procedure with a variable number of parameters

Stored procedure with a variable number of parameters

Scheduled Pinned Locked Moved Database
databasecomhelp
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.
  • V Offline
    V Offline
    Vadim Tabakman
    wrote on last edited by
    #1

    Hi all, I need to know if this is possible, and if it is, whats would a stored proc like that look like. What I'm looking for is a query that the stored proc will run, which will like the following : SELECT * FROM myTable WHERE ( SELECT COUNT(*) FROM myOtherTable WHERE (myOTID = @param1 OR myOTID = @param2 OR myOTID = @param3 OR [could me more ORs]) AND (myOtherTable.myID= myTable.myID) ) = 3 Any help would be much appreciated... Jubjub

    "If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)

    A 1 Reply Last reply
    0
    • V Vadim Tabakman

      Hi all, I need to know if this is possible, and if it is, whats would a stored proc like that look like. What I'm looking for is a query that the stored proc will run, which will like the following : SELECT * FROM myTable WHERE ( SELECT COUNT(*) FROM myOtherTable WHERE (myOTID = @param1 OR myOTID = @param2 OR myOTID = @param3 OR [could me more ORs]) AND (myOtherTable.myID= myTable.myID) ) = 3 Any help would be much appreciated... Jubjub

      "If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)

      A Offline
      A Offline
      Arun Immanuel
      wrote on last edited by
      #2

      Yes, it is possible. There are 3 ways to do this as mentioned here : Click Here[^]

      Regards, Arun Kumar.A

      V 1 Reply Last reply
      0
      • A Arun Immanuel

        Yes, it is possible. There are 3 ways to do this as mentioned here : Click Here[^]

        Regards, Arun Kumar.A

        V Offline
        V Offline
        Vadim Tabakman
        wrote on last edited by
        #3

        Thanx arul, that helps a lot. That helps more than a lot. I tweaked the code that Mark J. Miller wrote in that article to suit my needs and it works a treat. I appreciate the help Arul. Looks like I have malfunctions with my web surfing abilities :). -- modified at 20:38 Saturday 2nd June, 2007

        "If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)

        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