[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 715
  • Last Modified:

Can't launch OSQL with sa credentials

I just started using OSQL today for the first time to access MSDE on my home pc. I found that I cannot launch it by using the sa credentials. However it will allow me to use a trusted connection. Here the command line that doesn't work.

OSQL -S MyServer -U sa - P saPassword - d master.........

While this does work

OSQL -S MyServer -E - d master.........

The wierd thing is that Query Analyzer accepts the same sa credentials without a problem. Help please

Ian
0
ipendlebury
Asked:
ipendlebury
1 Solution
 
MohammedUCommented:
Is there any special character or space in the password? if so use double quote around the password.
0
 
ipendleburyAuthor Commented:
No the password is just lower case characters and a digit.
0
 
Marten RuneCommented:
Your problem is a extra space. You type:
OSQL -S MyServer -U sa - P saPassword - d master

When ist should be:
OSQL -S MyServer -U sa -P saPassword - d master

You have typed -<space>P instead of -P

/Marten
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ipendleburyAuthor Commented:
Well spotted! but unfortunately that was just an error when I posted the question in here. I didn't make that mistake in my batch file. I just tried it again and got the same error.
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Just for testing, try to call OSQL without -P parameter and then will ask you for password.
See if error persists.

Good luck
0
 
ipendleburyAuthor Commented:
I'm totaly confused now... I just tried it without the -P switch. It asked me for the password and accepted it. So I put the -P password back in and it still worked!!

I know I checked this so carefully yesterday. There's no way I had the wrong password in there. Especially when I was putting the same password in Query Analyzer. So I don't know how to explain this. But it works now so I'll thank everyone for their input.

Ian



0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Ian, I know it's weird and that's why I asked you to take off -P parameter.
Sometimes we are so used to do the same thing that we went in automatic mode and if there's any mistake we'll keep doing it. So the best way is to ask to someone to do it once for us or if we can just change the way we do it.
The most important as you have your problem solved.

Cheers.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now