Question

Just what the title says, I need to change the password for an existing sql server login and I want to do it via sql script.

Was it helpful?

OTHER TIPS

If the user already has the ALTER ANY LOGIN permission (i.e. the user can change any password for any user) then this works:

alter login mylogin with password = 'mylogin'

Otherwise, if you don't want to make every user in your system a superuser, add a parameter of the old password for the same command:

alter login mylogin with password = 'mylogin' old_password='oldpassword'
alter login mylogin with password = 'mylogin'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top