I got a laptop on which SQL Server Express is already installed. The server name is SRH\SQLEXPRESS and the version is 10.0.2531.0. The operating system is Windows 7.
I can connect to it through Windows Authentication. But I would like to connect to it though sa
. Since I dont know the password of sa
so I want to reset it. I decided to change it using osql
.
These are the steps I took to change the password of sa
:
- I opened command prompt (cmd) in Administrator mode.
- I typed in
osql -S SRH\SQLEXPRESS -E
and press Enter key. - Then I get the 1> prompt. I then typed in
sp_password null, 'HseWork11', 'sa'
and press Enter key. - Then I get the 2> prompt. I then typed in
GO
and press Enter key, But I get this error message:
Msg 15151, Level 16, State 1, Server SRH\SQLEXPRESS, Line 1 Cannot alter the login 'sa', because it does not exist or you do not have permission.
Bummer.
To confirm that the login sa
exist, I connect through Windows Authentication and run this statement select * from sys.syslogins where name = 'sa'
. I got 1 row back so the login sa
exist.
So why I cannot change sa
password using osql
? what I am doing wrong?