Simon's SQL

SQL,DBA,tuning,Trouble Shooting,Performance

Posts Tagged ‘SQLCMD MODE’

SQLCMD mode in SSMS

Posted by Simon Cho on 02/01/2017

SQLCMD mode in SSMS

Here are some commands very useful. Things help to deploy complicated queries.

 

:CONNECT localhost
:setvar DBA “DBA”

:on error exit
GO

USE [$(DBA)]
go
SELECT DB_NAME()

print ‘abc.sql – Simon’

:r c:\temp\abc.sql
GO
print ‘abcdef.sql – Simon’
:r c:\temp\abcdef.sql
GO

Advertisements

Posted in Common | Tagged: | Leave a Comment »