Modify the SQLServer database owner

xiaoxiao2021-03-05  22

Batch modification: Open Enterprise Manager, point local right - Properties - server settings, have an option that allows you to modify directly to the system directory, so that you can modify the system table. Point local right-edit SQLServer registration properties, hook the display system database and system objects so that the system table can be seen.

Find sysusers in the database to be modified, find the ID you need to modify the user in the table, the specific statement is as follows:

Select * from sysusers where name = "User Name"

Make a note of this user's UID value. In sysObjects, there is a UID field in the table, the value in the database is the ID number of the database, 1 is DBO, the other is the corresponding user, change him to 1. The specific statement is as follows:

Update sysobjects set uid = 1 where uid = the corresponding user's UID

Single modification: exec sp_changeObjectowner 'to change the table name,' DBO '

转载请注明原文地址:https://www.9cbs.com/read-39220.html

New Post(0)