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 Selects in SP

Multiple Selects in SP

Scheduled Pinned Locked Moved Database
sharepointquestion
4 Posts 4 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.
  • R Offline
    R Offline
    Russell Jones
    wrote on last edited by
    #1

    Hi I've got a login Proc that returns some data upon successful login. I've just added some checking code before this data to verify that the user may log in etc, but the resultsets from these checks are being returned in the dataset. Is there some way to clear the results before doing my final select statement? Thanks Russell

    A 1 Reply Last reply
    0
    • R Russell Jones

      Hi I've got a login Proc that returns some data upon successful login. I've just added some checking code before this data to verify that the user may log in etc, but the resultsets from these checks are being returned in the dataset. Is there some way to clear the results before doing my final select statement? Thanks Russell

      A Offline
      A Offline
      afronaut
      wrote on last edited by
      #2

      Not too sure if this will help but when I have a structure like that I use a reader. I can then write the following: if(r.Read()){ // they are valid, get user info if(r.NextResultSet()){ while(r.Read()){ // return additional data for that person } } } r.close(); *->>Always working on my game, teach me *->>something new. cout << "dav1d\n"; -- modified at 12:45 Monday 3rd October, 2005

      A 1 Reply Last reply
      0
      • A afronaut

        Not too sure if this will help but when I have a structure like that I use a reader. I can then write the following: if(r.Read()){ // they are valid, get user info if(r.NextResultSet()){ while(r.Read()){ // return additional data for that person } } } r.close(); *->>Always working on my game, teach me *->>something new. cout << "dav1d\n"; -- modified at 12:45 Monday 3rd October, 2005

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        I'm trying to get SQL to not return the recordsets that the SP uses internally and just return the data i really want. There's quite a bit of branching in the checking code which means i don't know exactly how many select statements will be executed prior to the select that i want executed.

        M 1 Reply Last reply
        0
        • A Anonymous

          I'm trying to get SQL to not return the recordsets that the SP uses internally and just return the data i really want. There's quite a bit of branching in the checking code which means i don't know exactly how many select statements will be executed prior to the select that i want executed.

          M Offline
          M Offline
          Michael Potter
          wrote on last edited by
          #4

          The easiest way around this is to not execute queries that return rows. Instead of: SELECT * FROM Users WHERE ID = "Tom" Do: DELCARE @i INTEGER SELECT @i = COUNT(*) FROM Users WHERE ID = "Tom" You can use logic to determine if @i > 0 then process the rest of the login. You can use any number of variables in the SELECT. Just make sure your query only returns 1 row. You can also use EXISTS: IF EXISTS(SELECT * FROM Users WHERE ID = "Tom") BEGIN -- Do your work here END

          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