SQL Server method to change the SA user name _mssql

Source: Internet
Author: User
First, run the following code in the Enterprise Manager's Query Analyzer (note that the user name that goes into the Query Analyzer is the system administrator and is the DB owner of each database):
Copy Code code as follows:

sp_configure ' allow updates ', 1
Go
Reconfigure with OVERRIDE
Go

And then run the following code
Copy Code code as follows:

Update sysxlogins set name= ' You want to change the name ' where sid=0x01
Update sysxlogins set sid=0xe765555bd44f054f89cd0076a06ea823 where name= ' you want to change the name '

Then:
Copy Code code as follows:

sp_configure ' allow updates ', 0
Go
Reconfigure with OVERRIDE
Go

Then, if you look at the role of SQL Server, you will find that the SA's username has been changed to your new name.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.