How do I script a password change for a SQL server login?

时光总嘲笑我的痴心妄想 提交于 2019-12-21 07:06:55

问题


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.


回答1:


ALTER LOGIN

http://msdn.microsoft.com/en-us/library/ms189828.aspx




回答2:


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'



回答3:


alter login mylogin with password = 'mylogin'


来源:https://stackoverflow.com/questions/56923/how-do-i-script-a-password-change-for-a-sql-server-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!