Adds or changes a password for a SQL Server login ID.
sp_password old, new [, login_id]
where
Any user can use sp_password to change his or her own password. Only the system administrator can change someone else's password (using the login_id parameter).
The old parameter is checked against the existing password for the user login_id (unless the user executing the procedure is the system administrator and the old parameter is NULL) and must match for the password to be changed. Passwords are encrypted in master.dbo.syslogins.password.
If front-end programs require the same password on remote servers as on the local server, a user must change his or her password on all the remote servers before changing the local password. The sp_password procedure should be executed as a call to a remote stored procedure on each remote server.
Execute permission defaults to the public group. Each member of public has permission to change only his or her own password. The system administrator can change any user's password.
master.dbo.syslogins
In this example, the system administrator has changed Victoria's password to ok. Notice that NULL is not enclosed in quotation marks.
sp_password NULL, ok, Victoria
In this example, the user Victoria changes her password from ok to coffee.
sp_password ok, coffee
sp_addlogin | xp_grantlogin |
sp_adduser | xp_logininfo |
sp_defaultdb | xp_revokelogin |