ALB
ALB

Reputation: 3

sqlcmd won't accept password as part of the initial command

I am using sqlcmd to query a SQL server database from a UBUNTU machine (an ODBC driver was installed for this purpose)

If I pass the following command:

sqlcmd -S xyz -d xyz -U xyz 

I am prompted for a password, and I can then successfully query the database in question. But, if pass the command below, I get the message 'Login failed for user ****':

sqlcmd -S xyz -d xyz -U xyz -P xyz

I need to be able to send the password in one pass, as I need to pass an input query file and send the output to a specific location. Once I log into the database by waiting for a password prompt, I can no longer specify input/output files. Any insights would be much appreciated

Upvotes: 0

Views: 1253

Answers (1)

souplex
souplex

Reputation: 981

Have you tried it without the space between the -P and the value? The docs show them glued together.

Upvotes: 1

Related Questions