Search code examples
sql-servercmdsqlcmd

Add a line break in sqlcmd output


I am working with SQL Server 2019 on Windows. I have a SQL script (.sql file) which I run from the command prompt using sqlcmd.

This is the script:

use master
go
select '$(SQLCMDWORKSTATION)' 'SQLCMDWORKSTATION';

When I run it I get the output:

Changed database context to 'master'.
SQLCMDWORKSTATION
-----------------
HP-ABC-DE-01

In the output I want to put an empty line after "Changed database context to 'master'". How can I do that?


Solution

  • Add a PRINT ''; just after the GO statement.