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. How to ignore and not return result sets

How to ignore and not return result sets

Scheduled Pinned Locked Moved Database
databasequestionsql-serversysadminhardware
3 Posts 2 Posters 11 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.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    I have discovered that in T-SQL for Sql Server 2022, if I run a stored procedure that happens to call another stored procedure that returns a result set, then the server returns both result sets to my application. How can I, within T-SQL, specify that the result set of an embedded stored procedure call is not part of the return to the client? Is there a way to specifically choose?

    The difficult we do right away... ...the impossible takes slightly longer.

    Richard DeemingR 1 Reply Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      I have discovered that in T-SQL for Sql Server 2022, if I run a stored procedure that happens to call another stored procedure that returns a result set, then the server returns both result sets to my application. How can I, within T-SQL, specify that the result set of an embedded stored procedure call is not part of the return to the client? Is there a way to specifically choose?

      The difficult we do right away... ...the impossible takes slightly longer.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      For a single resultset, you may be able to use INSERT .. EXEC to dump the resultset into a temporary table / table variable.

      DECLARE @tmp TABLE ( ... );
      INSERT INTO @tmp EXEC yourStoredProcedure ...;

      But if you control the other stored procedure, a cleaner option would be to add another parameter to suppress the output.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      Richard Andrew x64R 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        For a single resultset, you may be able to use INSERT .. EXEC to dump the resultset into a temporary table / table variable.

        DECLARE @tmp TABLE ( ... );
        INSERT INTO @tmp EXEC yourStoredProcedure ...;

        But if you control the other stored procedure, a cleaner option would be to add another parameter to suppress the output.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        Richard Andrew x64R Offline
        Richard Andrew x64R Offline
        Richard Andrew x64
        wrote on last edited by
        #3

        Thanks, Richard. I'm frankly surprised that there's no documented way to return only specific result sets. I'll probably end up using the additional parameter to suppress output. Cheers.

        The difficult we do right away... ...the impossible takes slightly longer.

        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