Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SQL Server Administration (2012)
 How to set password expiration OFF in 2012

Author  Topic 

asp__developer
Posting Yak Master

108 Posts

Posted - 2014-01-07 : 16:35:40
I have a login user that I created in security > logins (in 2012 SQL Server)

Everytime I try to login, it asks me to change the password.

So when I go to the properties of that login, there is a checkbox "Enforce password expiration".

When I try to uncheck / disable it - it gives me error message saying:-

"Alter failed for login 'username'
The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON"

But the option "User must change password at next login" is checked but not changable - how to uncheck or disable this option for my login ?

asp__developer
Posting Yak Master

108 Posts

Posted - 2014-01-07 : 16:41:55
I have tried this:

If you decide to use a query, you can use code similar to this
USE Master
GO
ALTER LOGIN test_must_change WITH PASSWORD = ‘samepassword’
GO
ALTER LOGIN test_must_change WITH
CHECK_POLICY = OFF,
CHECK_EXPIRATION = OFF;




But it gives me error

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '‘'.
Msg 15151, Level 16, State 1, Line 1
Cannot alter the login 'MYPASSWORD', because it does not exist or you do not have permission.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-07 : 16:44:46
You've got the wrong quotes around "samepassword". It should be: 'samepassword'. Your code has the tick marks instead.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

asp__developer
Posting Yak Master

108 Posts

Posted - 2014-01-07 : 16:48:40
But I already have one quote in the password as I posted above the query ?

‘samepassword’

As you can see I am not using double quote but still getting error ?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-07 : 17:00:28
No, you are using ticks. That's why you are getting the errors. Change it to single quotes. Or copy this and paste over yours: 'samepassword'

'samepassword' is not the same as ‘samepassword’

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -