Change Password for SQL Server User

Using Query Analyzer it is easy to coordinate with the database server while you would like to change the password, to change the SQL Server User name password,  just connect to the database with Query Analyzer using the SQL Server Username that is being updated and the current password. Then run “sp_password” to change the password. This approach provides the flexibility to change the password at the most appropriate time for the application.

sp_password [ [ @old = ] ‘old_password’ , ]

{ [ @new =] ‘new_password’ }

[ , [ @loginame = ] ‘login’ ]

The Office Microsoft Documentation for sp_password

Here is a simple example that changes the current password from
“currentPassword” to “newPassword”;

sp_password ‘currentPassword’, ‘newPassword’

However make sure to use a strong password, “newPassword” is just an example. For a quick test to confirm that the new password is working, close Query Analyzer and then re-connect with the new password. That is all there is to it, except for changing your connections string.

It is obvious, but still critical to remember to change the password in your connection string if this SQL User name is used in your code. Once the password has been changed and tested with Query Analyzer, update the connection string with the new password and test that  everything still works correctly, and you’re done.

permalinkRead More CommentComments (0) CatWeb Hosting

Leave a Reply

CSS Template by RamblingSoul || Tomodachi theme by Theme Lab