Hide Select Output from T-SQL Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraWhat Triggers This Warning: Type Conversion in Expression May Affect “CardinalityEstimate” in Query Plan ChoiceScript to query multiple instancesDuration Field in ProfilerAlter Time of DateTime FieldSql Profiler: what does Duration measure for exec sp_executeSQL Server Agent Jobs - Long running job delaying other jobs?Using GETDATE() in a variable returns 0 rowsTime taken to execute query seems longer than time measured in query…?The datediff function resulted in an overflowSQL Query: Print string (i.e. header) in output before returning table resultsSql Server - Execution Plan - Query Cost (relative to batch) calculation

Could moose/elk survive in the Amazon forest?

What’s with the clanks at the end of the credits in Avengers: Endgame?

What is purpose of DB Browser(dbbrowser.aspx) under admin tool?

What was Apollo 13's "Little Jolt" after MECO?

What is this word supposed to be?

finding a tangent line to a parabola

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

What does a straight horizontal line above a few notes, after a changed tempo mean?

Is there metaphorical meaning of "aus der Haft entlassen"?

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

Check if a string is entirely made of the same substring

Will I lose my paid in full property

How long after the last departure shall the airport stay open for an emergency return?

Is there any pythonic way to find average of specific tuple elements in array?

How would I use different systems of magic when they are capable of the same effects?

Was Dennis Ritchie being too modest in this quote about C and Pascal?

Is it possible to cast 2x Final Payment while sacrificing just one creature?

Contradiction proof for inequality of P and NP?

What's the difference between using dependency injection with a container and using a service locator?

How would this chord from "Rocket Man" be analyzed?

Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?

How to open locks without disable device?

Why do distances seem to matter in the Foundation world?

Is Electric Central Heating worth it if using Solar Panels?



Hide Select Output from T-SQL



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraWhat Triggers This Warning: Type Conversion in Expression May Affect “CardinalityEstimate” in Query Plan ChoiceScript to query multiple instancesDuration Field in ProfilerAlter Time of DateTime FieldSql Profiler: what does Duration measure for exec sp_executeSQL Server Agent Jobs - Long running job delaying other jobs?Using GETDATE() in a variable returns 0 rowsTime taken to execute query seems longer than time measured in query…?The datediff function resulted in an overflowSQL Query: Print string (i.e. header) in output before returning table resultsSql Server - Execution Plan - Query Cost (relative to batch) calculation



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








12















I'm trying to get query execution time, but I also want to hide the query output. I just want the elapsed time - no output.



Example



DECLARE @Start datetime
DECLARE @End datetime

SELECT @StartTimeWA=GETDATE()

SELECT
[id]
,[database_id]
,[proc_name]
,[exec_t] from
[DB].[dbo].[STAT]

SELECT @End=GETDATE()

SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


At the moment, I get query output and at the bottom my duration, which is the only thing I want as far as the output goes. I haven't been able to do this and wondering whether anyone else has come across similar problems? This is something I want to do in T-SQL not Management Studio or anything like that.



I'm trying to monitor the time it takes to run the select statement and report back to a server. I have an external monitor server which will run that every minute and get the time back (duration it took) which I will use over time to trend / baseline. As the current query spits out the select results and my duration it skews it, and my monitor server gets confused. I just wanted the duration column. I will also be doing this for inserts, which will be straightforward as it won't need to perform a select.



I'm trying to do this purely in T-SQL. I don't want to use DMVs as I want to get the time it takes (snapshot) when I run a query and check whether this changes over time when the server goes through the various levels of load as this will give me a good idea as to whether query execution time changes.










share|improve this question






























    12















    I'm trying to get query execution time, but I also want to hide the query output. I just want the elapsed time - no output.



    Example



    DECLARE @Start datetime
    DECLARE @End datetime

    SELECT @StartTimeWA=GETDATE()

    SELECT
    [id]
    ,[database_id]
    ,[proc_name]
    ,[exec_t] from
    [DB].[dbo].[STAT]

    SELECT @End=GETDATE()

    SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


    At the moment, I get query output and at the bottom my duration, which is the only thing I want as far as the output goes. I haven't been able to do this and wondering whether anyone else has come across similar problems? This is something I want to do in T-SQL not Management Studio or anything like that.



    I'm trying to monitor the time it takes to run the select statement and report back to a server. I have an external monitor server which will run that every minute and get the time back (duration it took) which I will use over time to trend / baseline. As the current query spits out the select results and my duration it skews it, and my monitor server gets confused. I just wanted the duration column. I will also be doing this for inserts, which will be straightforward as it won't need to perform a select.



    I'm trying to do this purely in T-SQL. I don't want to use DMVs as I want to get the time it takes (snapshot) when I run a query and check whether this changes over time when the server goes through the various levels of load as this will give me a good idea as to whether query execution time changes.










    share|improve this question


























      12












      12








      12


      2






      I'm trying to get query execution time, but I also want to hide the query output. I just want the elapsed time - no output.



      Example



      DECLARE @Start datetime
      DECLARE @End datetime

      SELECT @StartTimeWA=GETDATE()

      SELECT
      [id]
      ,[database_id]
      ,[proc_name]
      ,[exec_t] from
      [DB].[dbo].[STAT]

      SELECT @End=GETDATE()

      SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


      At the moment, I get query output and at the bottom my duration, which is the only thing I want as far as the output goes. I haven't been able to do this and wondering whether anyone else has come across similar problems? This is something I want to do in T-SQL not Management Studio or anything like that.



      I'm trying to monitor the time it takes to run the select statement and report back to a server. I have an external monitor server which will run that every minute and get the time back (duration it took) which I will use over time to trend / baseline. As the current query spits out the select results and my duration it skews it, and my monitor server gets confused. I just wanted the duration column. I will also be doing this for inserts, which will be straightforward as it won't need to perform a select.



      I'm trying to do this purely in T-SQL. I don't want to use DMVs as I want to get the time it takes (snapshot) when I run a query and check whether this changes over time when the server goes through the various levels of load as this will give me a good idea as to whether query execution time changes.










      share|improve this question
















      I'm trying to get query execution time, but I also want to hide the query output. I just want the elapsed time - no output.



      Example



      DECLARE @Start datetime
      DECLARE @End datetime

      SELECT @StartTimeWA=GETDATE()

      SELECT
      [id]
      ,[database_id]
      ,[proc_name]
      ,[exec_t] from
      [DB].[dbo].[STAT]

      SELECT @End=GETDATE()

      SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


      At the moment, I get query output and at the bottom my duration, which is the only thing I want as far as the output goes. I haven't been able to do this and wondering whether anyone else has come across similar problems? This is something I want to do in T-SQL not Management Studio or anything like that.



      I'm trying to monitor the time it takes to run the select statement and report back to a server. I have an external monitor server which will run that every minute and get the time back (duration it took) which I will use over time to trend / baseline. As the current query spits out the select results and my duration it skews it, and my monitor server gets confused. I just wanted the duration column. I will also be doing this for inserts, which will be straightforward as it won't need to perform a select.



      I'm trying to do this purely in T-SQL. I don't want to use DMVs as I want to get the time it takes (snapshot) when I run a query and check whether this changes over time when the server goes through the various levels of load as this will give me a good idea as to whether query execution time changes.







      sql-server t-sql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 13:46









      Paul White

      54.3k14288461




      54.3k14288461










      asked Mar 26 at 11:13









      GilliamGilliam

      694




      694




















          3 Answers
          3






          active

          oldest

          votes


















          28














          There are a lot of different ways to do this.



          I don't usually recommend inserting into a #temp table, since any tempdb load or autogrowth may impact the results, and I definitely don't recommend using a @table variable, since modifications to those are forced serial (no parallel plan can be used), which may change actual query times.



          Variable Assignment



          You can declare a variable and assign your columns to it, like this:



          DECLARE @Start datetime
          DECLARE @End datetime
          DECLARE @blob_eater SQL_VARIANT;

          SELECT @StartTimeWA=GETDATE()

          SELECT
          @blob_eater = [id]
          ,@blob_eater = [database_id]
          ,@blob_eater = [proc_name]
          ,@blob_eater = [exec_t] from
          [DB].[dbo].[STAT]

          SELECT @End=GETDATE()

          SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


          Though doing this may prevent some parameter embedding optimizations. See Parameter Sniffing, Embedding, and the RECOMPILE Options under "An Embedding Restriction".



          Note that this method may trigger plan warnings about implicit conversions, but they're not the kind you have to worry about. See this Q&A for background: What Triggers This Warning: Type Conversion in Expression May Affect “CardinalityEstimate” in Query Plan Choice.



          In SSMS



          You can change the settings to discard query results.



          NUTS



          SQL Query Stress



          SQL Query Stress is an open source tool that allows you to run queries against a SQL Server to simulate load. No query results are returned to the application when they're run.



          You can read some instructions on it here.



          ostress (RML Utilities)



          ostress is a similar tool, published by Microsoft, which also doesn't return results to the client, unless you choose to do it.



          I've written some about it here.



          Plan Explorer



          SentryOne's Plan Explorer is a free alternative to view SQL Server execution plans and deadlocks with.



          You can also use it as a client to query SQL Serve to some degree:



          NUTS



          This will also discard results.



          NUTS



          Hope this helps!






          share|improve this answer
































            0














            You could execute your query with SET STATISTICS TIME ON and capture the output message by using your monitoring app on your external monitor server.



            A way to capture the output message with .Net is explained in this Stack Overflow answer by AdaTheDev:




            You can do this by adding an event handler to the InfoMessage event on the connection.



            myConnection.InfoMessage += new SqlInfoMessageEventHandler(myConnection_InfoMessage);

            void myConnection_InfoMessage(object sender, SqlInfoMessageEventArgs e)

            myStringBuilderDefinedAsClassVariable.AppendLine(e.Message);







            share|improve this answer
































              0














              Could you not just use the initial select to return your @End?



              SELECT
              @blob_eater = [id]
              ,@blob_eater = [database_id]
              ,@blob_eater = [proc_name]
              ,@blob_eater = [exec_t] from
              [DB].[dbo].[STAT]



              SELECT @End=GETDATE()



              Becomes



              SELECT @End=GETDATE()
              FROM [DB].[dbo].[STAT]



              Only the last value would be stored in the variable.






              share|improve this answer























                Your Answer








                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "182"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                draft saved

                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233124%2fhide-select-output-from-t-sql%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                28














                There are a lot of different ways to do this.



                I don't usually recommend inserting into a #temp table, since any tempdb load or autogrowth may impact the results, and I definitely don't recommend using a @table variable, since modifications to those are forced serial (no parallel plan can be used), which may change actual query times.



                Variable Assignment



                You can declare a variable and assign your columns to it, like this:



                DECLARE @Start datetime
                DECLARE @End datetime
                DECLARE @blob_eater SQL_VARIANT;

                SELECT @StartTimeWA=GETDATE()

                SELECT
                @blob_eater = [id]
                ,@blob_eater = [database_id]
                ,@blob_eater = [proc_name]
                ,@blob_eater = [exec_t] from
                [DB].[dbo].[STAT]

                SELECT @End=GETDATE()

                SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


                Though doing this may prevent some parameter embedding optimizations. See Parameter Sniffing, Embedding, and the RECOMPILE Options under "An Embedding Restriction".



                Note that this method may trigger plan warnings about implicit conversions, but they're not the kind you have to worry about. See this Q&A for background: What Triggers This Warning: Type Conversion in Expression May Affect “CardinalityEstimate” in Query Plan Choice.



                In SSMS



                You can change the settings to discard query results.



                NUTS



                SQL Query Stress



                SQL Query Stress is an open source tool that allows you to run queries against a SQL Server to simulate load. No query results are returned to the application when they're run.



                You can read some instructions on it here.



                ostress (RML Utilities)



                ostress is a similar tool, published by Microsoft, which also doesn't return results to the client, unless you choose to do it.



                I've written some about it here.



                Plan Explorer



                SentryOne's Plan Explorer is a free alternative to view SQL Server execution plans and deadlocks with.



                You can also use it as a client to query SQL Serve to some degree:



                NUTS



                This will also discard results.



                NUTS



                Hope this helps!






                share|improve this answer





























                  28














                  There are a lot of different ways to do this.



                  I don't usually recommend inserting into a #temp table, since any tempdb load or autogrowth may impact the results, and I definitely don't recommend using a @table variable, since modifications to those are forced serial (no parallel plan can be used), which may change actual query times.



                  Variable Assignment



                  You can declare a variable and assign your columns to it, like this:



                  DECLARE @Start datetime
                  DECLARE @End datetime
                  DECLARE @blob_eater SQL_VARIANT;

                  SELECT @StartTimeWA=GETDATE()

                  SELECT
                  @blob_eater = [id]
                  ,@blob_eater = [database_id]
                  ,@blob_eater = [proc_name]
                  ,@blob_eater = [exec_t] from
                  [DB].[dbo].[STAT]

                  SELECT @End=GETDATE()

                  SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


                  Though doing this may prevent some parameter embedding optimizations. See Parameter Sniffing, Embedding, and the RECOMPILE Options under "An Embedding Restriction".



                  Note that this method may trigger plan warnings about implicit conversions, but they're not the kind you have to worry about. See this Q&A for background: What Triggers This Warning: Type Conversion in Expression May Affect “CardinalityEstimate” in Query Plan Choice.



                  In SSMS



                  You can change the settings to discard query results.



                  NUTS



                  SQL Query Stress



                  SQL Query Stress is an open source tool that allows you to run queries against a SQL Server to simulate load. No query results are returned to the application when they're run.



                  You can read some instructions on it here.



                  ostress (RML Utilities)



                  ostress is a similar tool, published by Microsoft, which also doesn't return results to the client, unless you choose to do it.



                  I've written some about it here.



                  Plan Explorer



                  SentryOne's Plan Explorer is a free alternative to view SQL Server execution plans and deadlocks with.



                  You can also use it as a client to query SQL Serve to some degree:



                  NUTS



                  This will also discard results.



                  NUTS



                  Hope this helps!






                  share|improve this answer



























                    28












                    28








                    28







                    There are a lot of different ways to do this.



                    I don't usually recommend inserting into a #temp table, since any tempdb load or autogrowth may impact the results, and I definitely don't recommend using a @table variable, since modifications to those are forced serial (no parallel plan can be used), which may change actual query times.



                    Variable Assignment



                    You can declare a variable and assign your columns to it, like this:



                    DECLARE @Start datetime
                    DECLARE @End datetime
                    DECLARE @blob_eater SQL_VARIANT;

                    SELECT @StartTimeWA=GETDATE()

                    SELECT
                    @blob_eater = [id]
                    ,@blob_eater = [database_id]
                    ,@blob_eater = [proc_name]
                    ,@blob_eater = [exec_t] from
                    [DB].[dbo].[STAT]

                    SELECT @End=GETDATE()

                    SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


                    Though doing this may prevent some parameter embedding optimizations. See Parameter Sniffing, Embedding, and the RECOMPILE Options under "An Embedding Restriction".



                    Note that this method may trigger plan warnings about implicit conversions, but they're not the kind you have to worry about. See this Q&A for background: What Triggers This Warning: Type Conversion in Expression May Affect “CardinalityEstimate” in Query Plan Choice.



                    In SSMS



                    You can change the settings to discard query results.



                    NUTS



                    SQL Query Stress



                    SQL Query Stress is an open source tool that allows you to run queries against a SQL Server to simulate load. No query results are returned to the application when they're run.



                    You can read some instructions on it here.



                    ostress (RML Utilities)



                    ostress is a similar tool, published by Microsoft, which also doesn't return results to the client, unless you choose to do it.



                    I've written some about it here.



                    Plan Explorer



                    SentryOne's Plan Explorer is a free alternative to view SQL Server execution plans and deadlocks with.



                    You can also use it as a client to query SQL Serve to some degree:



                    NUTS



                    This will also discard results.



                    NUTS



                    Hope this helps!






                    share|improve this answer















                    There are a lot of different ways to do this.



                    I don't usually recommend inserting into a #temp table, since any tempdb load or autogrowth may impact the results, and I definitely don't recommend using a @table variable, since modifications to those are forced serial (no parallel plan can be used), which may change actual query times.



                    Variable Assignment



                    You can declare a variable and assign your columns to it, like this:



                    DECLARE @Start datetime
                    DECLARE @End datetime
                    DECLARE @blob_eater SQL_VARIANT;

                    SELECT @StartTimeWA=GETDATE()

                    SELECT
                    @blob_eater = [id]
                    ,@blob_eater = [database_id]
                    ,@blob_eater = [proc_name]
                    ,@blob_eater = [exec_t] from
                    [DB].[dbo].[STAT]

                    SELECT @End=GETDATE()

                    SELECT DATEDIFF(MS,@Start,@End) AS [Duration]


                    Though doing this may prevent some parameter embedding optimizations. See Parameter Sniffing, Embedding, and the RECOMPILE Options under "An Embedding Restriction".



                    Note that this method may trigger plan warnings about implicit conversions, but they're not the kind you have to worry about. See this Q&A for background: What Triggers This Warning: Type Conversion in Expression May Affect “CardinalityEstimate” in Query Plan Choice.



                    In SSMS



                    You can change the settings to discard query results.



                    NUTS



                    SQL Query Stress



                    SQL Query Stress is an open source tool that allows you to run queries against a SQL Server to simulate load. No query results are returned to the application when they're run.



                    You can read some instructions on it here.



                    ostress (RML Utilities)



                    ostress is a similar tool, published by Microsoft, which also doesn't return results to the client, unless you choose to do it.



                    I've written some about it here.



                    Plan Explorer



                    SentryOne's Plan Explorer is a free alternative to view SQL Server execution plans and deadlocks with.



                    You can also use it as a client to query SQL Serve to some degree:



                    NUTS



                    This will also discard results.



                    NUTS



                    Hope this helps!







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 26 at 12:50

























                    answered Mar 26 at 12:45









                    Erik DarlingErik Darling

                    23.1k1370114




                    23.1k1370114























                        0














                        You could execute your query with SET STATISTICS TIME ON and capture the output message by using your monitoring app on your external monitor server.



                        A way to capture the output message with .Net is explained in this Stack Overflow answer by AdaTheDev:




                        You can do this by adding an event handler to the InfoMessage event on the connection.



                        myConnection.InfoMessage += new SqlInfoMessageEventHandler(myConnection_InfoMessage);

                        void myConnection_InfoMessage(object sender, SqlInfoMessageEventArgs e)

                        myStringBuilderDefinedAsClassVariable.AppendLine(e.Message);







                        share|improve this answer





























                          0














                          You could execute your query with SET STATISTICS TIME ON and capture the output message by using your monitoring app on your external monitor server.



                          A way to capture the output message with .Net is explained in this Stack Overflow answer by AdaTheDev:




                          You can do this by adding an event handler to the InfoMessage event on the connection.



                          myConnection.InfoMessage += new SqlInfoMessageEventHandler(myConnection_InfoMessage);

                          void myConnection_InfoMessage(object sender, SqlInfoMessageEventArgs e)

                          myStringBuilderDefinedAsClassVariable.AppendLine(e.Message);







                          share|improve this answer



























                            0












                            0








                            0







                            You could execute your query with SET STATISTICS TIME ON and capture the output message by using your monitoring app on your external monitor server.



                            A way to capture the output message with .Net is explained in this Stack Overflow answer by AdaTheDev:




                            You can do this by adding an event handler to the InfoMessage event on the connection.



                            myConnection.InfoMessage += new SqlInfoMessageEventHandler(myConnection_InfoMessage);

                            void myConnection_InfoMessage(object sender, SqlInfoMessageEventArgs e)

                            myStringBuilderDefinedAsClassVariable.AppendLine(e.Message);







                            share|improve this answer















                            You could execute your query with SET STATISTICS TIME ON and capture the output message by using your monitoring app on your external monitor server.



                            A way to capture the output message with .Net is explained in this Stack Overflow answer by AdaTheDev:




                            You can do this by adding an event handler to the InfoMessage event on the connection.



                            myConnection.InfoMessage += new SqlInfoMessageEventHandler(myConnection_InfoMessage);

                            void myConnection_InfoMessage(object sender, SqlInfoMessageEventArgs e)

                            myStringBuilderDefinedAsClassVariable.AppendLine(e.Message);








                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Mar 26 at 16:32









                            Paul White

                            54.3k14288461




                            54.3k14288461










                            answered Mar 26 at 16:19









                            Evandro MuchinskiEvandro Muchinski

                            705112




                            705112





















                                0














                                Could you not just use the initial select to return your @End?



                                SELECT
                                @blob_eater = [id]
                                ,@blob_eater = [database_id]
                                ,@blob_eater = [proc_name]
                                ,@blob_eater = [exec_t] from
                                [DB].[dbo].[STAT]



                                SELECT @End=GETDATE()



                                Becomes



                                SELECT @End=GETDATE()
                                FROM [DB].[dbo].[STAT]



                                Only the last value would be stored in the variable.






                                share|improve this answer



























                                  0














                                  Could you not just use the initial select to return your @End?



                                  SELECT
                                  @blob_eater = [id]
                                  ,@blob_eater = [database_id]
                                  ,@blob_eater = [proc_name]
                                  ,@blob_eater = [exec_t] from
                                  [DB].[dbo].[STAT]



                                  SELECT @End=GETDATE()



                                  Becomes



                                  SELECT @End=GETDATE()
                                  FROM [DB].[dbo].[STAT]



                                  Only the last value would be stored in the variable.






                                  share|improve this answer

























                                    0












                                    0








                                    0







                                    Could you not just use the initial select to return your @End?



                                    SELECT
                                    @blob_eater = [id]
                                    ,@blob_eater = [database_id]
                                    ,@blob_eater = [proc_name]
                                    ,@blob_eater = [exec_t] from
                                    [DB].[dbo].[STAT]



                                    SELECT @End=GETDATE()



                                    Becomes



                                    SELECT @End=GETDATE()
                                    FROM [DB].[dbo].[STAT]



                                    Only the last value would be stored in the variable.






                                    share|improve this answer













                                    Could you not just use the initial select to return your @End?



                                    SELECT
                                    @blob_eater = [id]
                                    ,@blob_eater = [database_id]
                                    ,@blob_eater = [proc_name]
                                    ,@blob_eater = [exec_t] from
                                    [DB].[dbo].[STAT]



                                    SELECT @End=GETDATE()



                                    Becomes



                                    SELECT @End=GETDATE()
                                    FROM [DB].[dbo].[STAT]



                                    Only the last value would be stored in the variable.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Apr 15 at 16:48









                                    Patrick HurstPatrick Hurst

                                    1




                                    1



























                                        draft saved

                                        draft discarded
















































                                        Thanks for contributing an answer to Database Administrators Stack Exchange!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid


                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.

                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233124%2fhide-select-output-from-t-sql%23new-answer', 'question_page');

                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum

                                        He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

                                        Slayer Innehåll Historia | Stil, komposition och lyrik | Bandets betydelse och framgångar | Sidoprojekt och samarbeten | Kontroverser | Medlemmar | Utmärkelser och nomineringar | Turnéer och festivaler | Diskografi | Referenser | Externa länkar | Navigeringsmenywww.slayer.net”Metal Massacre vol. 1””Metal Massacre vol. 3””Metal Massacre Volume III””Show No Mercy””Haunting the Chapel””Live Undead””Hell Awaits””Reign in Blood””Reign in Blood””Gold & Platinum – Reign in Blood””Golden Gods Awards Winners”originalet”Kerrang! Hall Of Fame””Slayer Looks Back On 37-Year Career In New Video Series: Part Two””South of Heaven””Gold & Platinum – South of Heaven””Seasons in the Abyss””Gold & Platinum - Seasons in the Abyss””Divine Intervention””Divine Intervention - Release group by Slayer””Gold & Platinum - Divine Intervention””Live Intrusion””Undisputed Attitude””Abolish Government/Superficial Love””Release “Slatanic Slaughter: A Tribute to Slayer” by Various Artists””Diabolus in Musica””Soundtrack to the Apocalypse””God Hates Us All””Systematic - Relationships””War at the Warfield””Gold & Platinum - War at the Warfield””Soundtrack to the Apocalypse””Gold & Platinum - Still Reigning””Metallica, Slayer, Iron Mauden Among Winners At Metal Hammer Awards””Eternal Pyre””Eternal Pyre - Slayer release group””Eternal Pyre””Metal Storm Awards 2006””Kerrang! Hall Of Fame””Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Bullet-For My Valentine booed at Metal Hammer Golden Gods Awards””Unholy Aliance””The End Of Slayer?””Slayer: We Could Thrash Out Two More Albums If We're Fast Enough...””'The Unholy Alliance: Chapter III' UK Dates Added”originalet”Megadeth And Slayer To Co-Headline 'Canadian Carnage' Trek”originalet”World Painted Blood””Release “World Painted Blood” by Slayer””Metallica Heading To Cinemas””Slayer, Megadeth To Join Forces For 'European Carnage' Tour - Dec. 18, 2010”originalet”Slayer's Hanneman Contracts Acute Infection; Band To Bring In Guest Guitarist””Cannibal Corpse's Pat O'Brien Will Step In As Slayer's Guest Guitarist”originalet”Slayer’s Jeff Hanneman Dead at 49””Dave Lombardo Says He Made Only $67,000 In 2011 While Touring With Slayer””Slayer: We Do Not Agree With Dave Lombardo's Substance Or Timeline Of Events””Slayer Welcomes Drummer Paul Bostaph Back To The Fold””Slayer Hope to Unveil Never-Before-Heard Jeff Hanneman Material on Next Album””Slayer Debut New Song 'Implode' During Surprise Golden Gods Appearance””Release group Repentless by Slayer””Repentless - Slayer - Credits””Slayer””Metal Storm Awards 2015””Slayer - to release comic book "Repentless #1"””Slayer To Release 'Repentless' 6.66" Vinyl Box Set””BREAKING NEWS: Slayer Announce Farewell Tour””Slayer Recruit Lamb of God, Anthrax, Behemoth + Testament for Final Tour””Slayer lägger ner efter 37 år””Slayer Announces Second North American Leg Of 'Final' Tour””Final World Tour””Slayer Announces Final European Tour With Lamb of God, Anthrax And Obituary””Slayer To Tour Europe With Lamb of God, Anthrax And Obituary””Slayer To Play 'Last French Show Ever' At Next Year's Hellfst””Slayer's Final World Tour Will Extend Into 2019””Death Angel's Rob Cavestany On Slayer's 'Farewell' Tour: 'Some Of Us Could See This Coming'””Testament Has No Plans To Retire Anytime Soon, Says Chuck Billy””Anthrax's Scott Ian On Slayer's 'Farewell' Tour Plans: 'I Was Surprised And I Wasn't Surprised'””Slayer””Slayer's Morbid Schlock””Review/Rock; For Slayer, the Mania Is the Message””Slayer - Biography””Slayer - Reign In Blood”originalet”Dave Lombardo””An exclusive oral history of Slayer”originalet”Exclusive! Interview With Slayer Guitarist Jeff Hanneman”originalet”Thinking Out Loud: Slayer's Kerry King on hair metal, Satan and being polite””Slayer Lyrics””Slayer - Biography””Most influential artists for extreme metal music””Slayer - Reign in Blood””Slayer guitarist Jeff Hanneman dies aged 49””Slatanic Slaughter: A Tribute to Slayer””Gateway to Hell: A Tribute to Slayer””Covered In Blood””Slayer: The Origins of Thrash in San Francisco, CA.””Why They Rule - #6 Slayer”originalet”Guitar World's 100 Greatest Heavy Metal Guitarists Of All Time”originalet”The fans have spoken: Slayer comes out on top in readers' polls”originalet”Tribute to Jeff Hanneman (1964-2013)””Lamb Of God Frontman: We Sound Like A Slayer Rip-Off””BEHEMOTH Frontman Pays Tribute To SLAYER's JEFF HANNEMAN””Slayer, Hatebreed Doing Double Duty On This Year's Ozzfest””System of a Down””Lacuna Coil’s Andrea Ferro Talks Influences, Skateboarding, Band Origins + More””Slayer - Reign in Blood””Into The Lungs of Hell””Slayer rules - en utställning om fans””Slayer and Their Fans Slashed Through a No-Holds-Barred Night at Gas Monkey””Home””Slayer””Gold & Platinum - The Big 4 Live from Sofia, Bulgaria””Exclusive! Interview With Slayer Guitarist Kerry King””2008-02-23: Wiltern, Los Angeles, CA, USA””Slayer's Kerry King To Perform With Megadeth Tonight! - Oct. 21, 2010”originalet”Dave Lombardo - Biography”Slayer Case DismissedArkiveradUltimate Classic Rock: Slayer guitarist Jeff Hanneman dead at 49.”Slayer: "We could never do any thing like Some Kind Of Monster..."””Cannibal Corpse'S Pat O'Brien Will Step In As Slayer'S Guest Guitarist | The Official Slayer Site”originalet”Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Kerrang! Awards 2006 Blog: Kerrang! Hall Of Fame””Kerrang! Awards 2013: Kerrang! Legend”originalet”Metallica, Slayer, Iron Maien Among Winners At Metal Hammer Awards””Metal Hammer Golden Gods Awards””Bullet For My Valentine Booed At Metal Hammer Golden Gods Awards””Metal Storm Awards 2006””Metal Storm Awards 2015””Slayer's Concert History””Slayer - Relationships””Slayer - Releases”Slayers officiella webbplatsSlayer på MusicBrainzOfficiell webbplatsSlayerSlayerr1373445760000 0001 1540 47353068615-5086262726cb13906545x(data)6033143kn20030215029