SQLTeam.com | Weblogs | Forums

SQL export to text file - unwanted message at end


Is there a way of stopping SSMS adding

(5 rows affected)
Completion time: 2021-05-20T14:00:51.5025040+01:00

to the end of an export to text file?

For rowcount, use SET NOCOUNT ON before the T-SQL statements you're running.

For completion time, go to Tools->Options->Query Execution->SQL Server->Advanced and look for "Show Completion Time" and un-check it. I can't remember when that option was added, it's in version 18.7 of SSMS, but wasn't in earlier versions.

BTW the SQLCMD utility never includes completion times, if you need to automate query output.