SqlWorldWide
SqlWorldWide

Reputation: 369

SQLCMD from SSMS is not working; connecting to Azure SQL Database

Running this from my SQL Server Management Studuio (SSMS) connecting to Azure sql database. I am using SQLCMD mode of SSMS.

:Connect -S taiobdemo1.database.windows.net -d taiobcustomer -U sqlusername -P strongpw

Getting this error:

A fatal scripting error occurred. Incorrect syntax was encountered while parsing :Connect.

Upvotes: 0

Views: 808

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89141

The :connnect SqlCmd command does not allow you to specify a target database. You'll always connect to your default database. So it's pretty useless in Azure SQL Database, as you'll be connected to Master and won't be able to switch.

eg

:Connect xxxx.database.windows.net  -U someuser -P xxxx
select db_name()

Will always output master

Upvotes: 1

Related Questions