When password needs to changed?
1. If we forgot password.
2. When password expiration level reached(If customized). By default option is set to ever expiry password.
What are the prerequisites to change password?
1. Caller password(Whoever is changing password of other user or him/herself)
2. Only System Security Officer can change the password.
Syntax to change Password:
sp_password caller_passwd, new_passwd [, loginame, @immediate]
Example:
1> sp_password password,xyz@1234,k2admin 2> go Password correctly set. (return status = 0)
Note: We cannt change the password to same as old one. If we want to change password as same, first change to some other password. Then, change to older password.
If try to change to same password as previous, we will get below error.
1> sp_password password,xyz@1234,k2admin 2> go Msg 10315, Level 14, State 1: Server 'k2_prod', Procedure 'sp_password', Line 148: Invalid caller's password specified, password left unchanged. Msg 17720, Level 16, State 1: Server 'k2_prod', Procedure 'sp_password', Line 158: Error: Unable to set the Password. (return status = 1)