SQL Server – How to Get Query Timing with sqlcmd

benchmarkclientlinuxnative-clientsql-server-2017

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.

Best Answer

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

They work for me using sqlcmd on windows:

sqlcmd windows