Reputation: 159
In SSMS, when I execute
sqlcmd -S "flynetSrv"
I get :
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'S'.
I am already connected to the server through SSMS
I also tried
sqlcmd -d "dbname1"
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'd'.
Please help?
Upvotes: 3
Views: 4884
Reputation: 18958
sqlcmd
is an utility intended to be used in a command prompt
You cannot use it in a SQL Server Management Studio (SSMS) query window
You can only write or edit SQLCMD scripts within the query window enabling the SQLCMD mode (Query menu -> SQLCMD Mode)
From MSDN - Editing SQLCMD Scripts with Query Editor:
To use the Database Engine Query Editor to write or edit SQLCMD scripts, you must enable the SQLCMD scripting mode.
Upvotes: 3