SQL SERVER 2016修改“User Mapping"时报错:
TITLE: Microsoft SQL Server Management Studio------------------------------ Rename failed for User 'dbo'. (Microsoft.SqlServer.Smo) For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.37971.0&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Rename+User&LinkId=20476 ------------------------------
ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ Cannot alter the user 'dbo'. (Microsoft SQL Server, Error: 15150) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=13.00.5026&EvtSrc=MSSQLServer&EvtID=15150&LinkId=20476 ------------------------------
BUTTONS: OK
------------------------------
解决方法:
以SA登录SQL SERVER STUDIO,执行下面的命令:
use testdatabaseName
EXEC sp_changedbowner 'sa','true'