The SetPassword method changes the password for the referenced login.
object.SetPassword( OldValue , NewValue )
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list |
OldValue | String specifying the current password string |
NewValue | String specifying a new password for the login record |
Use the SetPassword method to alter a password for a login record used by SQL Server Authentication only.
The current password need not be known when setting a new password by using the SetPassword method. Use an empty string to specify no password for either the existing password or a new password for the login.
Changing Microsoft® SQL Server™ login passwords by using the SetPassword method requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of the fixed role sysadmin.
HRESULT SetPassword(
SQLDMO_LPCSTR OldValue,
SQLDMO_LPCSTR NewValue);