HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How do I get the Query Timing with sqlcmd?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thewithquerytiminggetsqlcmdhow

Problem

Running SQL Server 2017, using the interactive REPL client sqlcmd how do I get the time for Query Execution?

You can sp_BlitzErik showing this in his answer here,

SQL Server Execution Times:
  CPU time = 1859 ms,  elapsed time = 321 ms.

Solution

I think that what you're looking for are the SET STATISTICS commands:

  • SET STATISTICS TIME



  • SET STATISTICS IO



They work for me using sqlcmd on windows:

Context

StackExchange Database Administrators Q#174273, answer score: 8

Revisions (0)

No revisions yet.