tencentdb_ChangeLoginPassword is a stored procedure deployed in the master database of a SQL Server instance, enabling users to self-service modify passwords for their SQL Logins. Users can complete password modification without requiring the sysadmin role.USE masterGOEXEC dbo.tencentdb_ChangeLoginPassword@login = N'<target_login_name>',@new_password = N'<new_password>'
Parameter | Type | Description |
@login | SYSNAME | SQL Login name for which the password is to be changed |
@new_password | NVARCHAR(128) | New Password |
Return Code | Description |
0 | Successful |
51001 | The login name is in the system blocklist. |
51002 | The login name does not exist or is not an SQL Login. |
51004 | Modification of sa (system built-in privileged account) is not allowed. |
51006 | The password contains special characters prohibited by the server security policy. |
51007 | The target login name is a member of a privileged server role (sysadmin/securityadmin/serveradmin). |
51008 | The password does not meet the complexity requirements. |
51009 | Password length exceeds the limit (> 32 characters). |
Rule | Requirement |
Length | 8 to 32 characters |
Complexity | Contain at least 2 types from letters, numbers, and symbols |
Excluding account name | The password must not contain the login name (case-insensitive). |
Special character restriction | Must not contain special character combinations such as ];, [;, ;[, '], [', and so on |
-- Password successfully changed.EXEC dbo.tencentdb_ChangeLoginPassword @login = N'myapp_user', @new_password = N'NewP@ss2026!'-- Returns 0-- Attempt to modify a system account (denied)EXEC dbo.tencentdb_ChangeLoginPassword @login = N'tencent_admin', @new_password = N'Test1234!'-- Msg 51001: Login is in the system blacklist and cannot be modified.-- Password does not meet complexity requirements (denied)EXEC dbo.tencentdb_ChangeLoginPassword @login = N'myapp_user', @new_password = N'123'-- Msg 51008: Password does not meet complexity requirements.
USE master.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback