RS First Dynamics NAV Blog


...from NAV 3.60 to NAV 2013
Archivio Posts
Anno 2015

Anno 2014

Anno 2013

Anno 2012

Anno 2011

Anno 2010

Anno 2009

Anno 2008

Anno 2007

Identify SQL Server 2005 Standard Login Settings

The way to see what logins fit which of these three options is easily done by query the catalog view sys.sql_logins.
The following query provides that information:

SELECT 
    [name]
  , is_policy_checked
  , is_expiration_checked
FROM sys.sql_logins;

OPTIONS
Must change password at next login

SELECT LOGINPROPERTY('sa', 'IsMustChange');
GO
 
Result Set Legend
0 - Must not change password at next login
1 - Must change password at next login

Expired password

SELECT LOGINPROPERTY('sa', 'IsExpired');
GO
 
Result Set Legend
0 - Password is not expired
1 - Password

------------------------------------------------------------------------------------

Change Password

sp_password [ [ @old = ] 'old_password' , ]
      { [ @new =] 'new_password' }
      [ , [ @loginame = ] 'login' ]

Here is a simple example that changes the current password from
"currentPSWD" to "newPSWD";

sp_password 'currentPSWD', 'newPSWD'

ALTER LOGIN
ALTER LOGIN login_name
    {
   
    | WITH [ ,... ]
    |
    }

::=
        ENABLE | DISABLE

::=           
    PASSWORD = 'password' | hashed_password HASHED
    [
      OLD_PASSWORD = 'oldpassword'
      | [ ]
    ]
    | DEFAULT_DATABASE = database
    | DEFAULT_LANGUAGE = language
    | NAME = login_name
    | CHECK_POLICY = { ON | OFF }
    | CHECK_EXPIRATION = { ON | OFF }
    | CREDENTIAL = credential_name
    | NO CREDENTIAL
 
::=
    MUST_CHANGE | UNLOCK
::=
         ADD CREDENTIAL credential_name
          | DROP CREDENTIAL credential_name

Set Login Password 'Must Change'

I need some SQL Syntax to set the "Must Change" attribute of a Login WITHOUT having to change the current password.

I know this will do it, but it simultaneously changes the password:


ALTER LOGIN [myUser] WITH Password='$Reset123' MUST_CHANGE

Categoria: Sql Server ALL
sabato, 06 feb 2010 Ore. 19.14

Messaggi collegati


Statistiche
  • Views Home Page: 451.250
  • Views Posts: 863.657
  • Views Gallerie: 0
  • n° Posts: 343
  • n° Commenti: 0
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003