SQL SERVER – Change Password at the First Login

Just like many other databases and applications, SQL Server also supports the feature to change password at the first login. Let us see the script of how we can do it.

Here is the script:

CREATE LOGIN LoginName
WITH PASSWORD = 'VeryStrongPassword'
MUST_CHANGE, CHECK_EXPIRATION = ON;

When you run the script above, it will create a new login and set the new password policy. If we create the login with password – MUST_CHANGE, whenever the user logs in the first time, the user will have to change the password.

One should also remember that if you say the password must change, you should also set CHECK_EXPIRATION as ON, otherwise it will not work.

Well, that’s it for today. I hope you like the blog post and leave a comment.

Let me know if you are interested to know more about this topic and I will write more blogs as well as create an SQL in Sixty Seconds video.

Here are my few recent videos and I would like to know what is your feedback about them.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

Menu
Exit mobile version