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.
- Find Expensive Queries – SQL in Sixty Seconds #159
- Case-Sensitive Search – SQL in Sixty Seconds #158
- Wait Stats for Performance – SQL in Sixty Seconds #157
- Multiple Backup Copies Stripped – SQL in Sixty Seconds #156
Reference:Â Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)