1

I have multiple servers in my workspace I am trying to connect to and would like to make a single SQL script to do so. To connect to each server Windows Credentials are required and the option on the server is not set otherwise, nor do I have access to them lest I can convince of need.

Is it then possible to use the :Connect command to pass my windows credentials or can I only do so using SQL Server Authentication?

Thanks in advance.

Outis
  • 13
  • 3

1 Answers1

0

By default, sqlcmd will use integrated authentication (Windows credentials). You can specify it using -E, as dsolimano mentioned, but it's unecessary.

By excluding the -U for username and -P for password switches, it's implied you wish to use your Windows credentials.

An example would be:

sqlcmd -S ServerName -i script.sql -o results.txt

  • Thanks, I was having a hard time seeing where this was explicitly called out since I was working within the query editor and am still learning how to properly call options in there. – Outis Dec 31 '14 at 17:31