Forum Discussion
Login failed for user 'sp'. Reason: Password did not match that for the login provided
- Jul 22, 2024
I'm taking a wild guess that you're running the commands from the Command Prompt (the old-school environment that came well before PowerShell).
If that's true, then it's important to know that the command prompt processor only recognises double quotes as string delimiters, meaning the password you're attempting to log in with is actually the value:
'sp'
Which doesn't match the earlier password you set inside the sqlcmd session of:
sp
So, in other words, for your second sqlcmd where you're trying to log in using the new sp account, use the following for the password:
- sp
- "sp" (Again, the command prompt recognises double quotes as string delimiters.)
Do not use 'sp' (as the command prompt will include single quotes in the actual password value).
Cheers,
Lain
C:\Users\john>
C:\Users\john>sqlcmd -s jw-lat,1433 -U sp -P sp
1> select current_user from dual;
2> go
Msg 208, Level 16, State 1, Server jw-lat, Line 1
Invalid object name 'dual'.
1> select current_user;
2> go
--------------------------------------------------------------------------------------------------------------------------------
dbo
(1 rows affected)
1>
Thankyou again.
Invalid object name 'dual'.
John_S_Watson , the system object dual exists in Oracle databases, but not in MS SQL Server.