The code to modify the database sa account name is as follows:
The code is as follows:
Alter LOGIN SA DISABLE
Alter LOGIN sa with NAME = [Systemaccount]
"Systemaccount" is the new name of SA, refresh the right login after execution to see the successful account name.
SQL Server 2005 How to modify the SA user password method graphic version
I. Ways to modify the SA user password in SQL Server 2005
1. Click "Start-All Programs-Microsoft SQL Server 2005-configuration tools-SQL Server Configuration Manager", open "SQL Server Configuration Manager Window As shown in the following:
2. Open SQL Server 2005 Network Configuration, click on the "SQL2005 protocol (here, use our installed instance name)" Entry as shown in:
3. Right-click on the "Named Pipes" button on the right and click "Enable" in the Popup submenu to bring up the "Warning" dialog box. As shown in the following:
4. Click the "OK" button.
5. Open "SQL Native Client Configuration" and click on the "Client Protocol" entry. As shown in the following:
6. Right-click on the "Named Pipes" button on the right and click "Enable" in the Popup submenu. Close the SQL Server Configuration Manager window.
7. Click "Start-All Programs-Microsoft SQL server 2005-sql server Management Studio" and select "Windows Authentication" in the "Connect to Server" window. As shown in the following:
8. Click the "Connect" button and log in to "Microsoft SQL Server Management Studio".
9. Right-click on the instance name \ (SQL Server 9.0.5000) in the Object Explorer window and select the Properties command from the Popup submenu. As shown in the following:
10. Open the Server Properties window. As shown in the following:
11. Select the security item in the Select page, select the SQL server and Windows Authentication mode entry in Server Authentication, and then click the OK button.
12. In the Object Explorer window, open the security entry, open the login name entry, right-click the SA, and select Properties from the Popup submenu. As shown in the following:
13. Open the Login Properties window. As shown in the following:
14. After changing the password, remove the tick (√) in front of "Enforce Password Policy" and click the "OK" button.
At this point, the password modification of the SA user in SQL Server 2005 succeeds!
15. Start SQL Server Management Studio, and in the Connect to Server dialog box, select SQL Server Authentication. As shown in the following:
16. Enter "SA" in the "Login name" box, enter the modified password, then click the "Connect" button to successfully launch "SQL Server Management Studio"!
II. using SQL statements to modify the password of the SA user in SQL Server 2005
First, start SQL Server Management Studio by using Windows authentication,
Second, select the SQL server and Windows authentication mode item in the Server Properties window,
Then, cancel the "Enforce Password Policy" entry.
Finally, in new query, execute one of the following code:
Code One:
ALTER LOGIN SA ENABLE; GO ALTER LOGIN sa with PASSWORD = ' PASSWORD '; GO
Code two:
ALTER LOGIN sa with PASSWORD = n ' New password '-This can be used: with PASSWORD = N ' 123456 ' old_password = n ' old password '
Code Three:
ALTER LOGIN [SA] with password=n ' newpassword '--can not provide old password--alter login [sa] with password=n ' 123456 '
Change the user name and password for SA in SQL Server 2005