SQL 2005 建立数据库图表时出现以下错误Database diagram support objects cannot be installed because this database does not have a valid owner 解决

来源:互联网 发布:ios cell数组赋值 编辑:程序博客网 时间:2024/04/28 08:20

在SQL2005中建立数据库图表时出现以下错误:
"Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects."

分条执行以下语句:

EXEC sp_dbcmptlevel '数据库名''90';
go

ALTER AUTHORIZATION ON DATABASE::数据库名 TO "当前登陆用户名"
go

use [数据库名]
go

EXECUTE AS USER = N'dbo' REVERT
go

 

eg:

EXEC sp_dbcmptlevel 'idr_history_rdb', '90';
go

ALTER AUTHORIZATION ON DATABASE::idr_history_rdb TO "sa"
go

use [idr_history_rdb]
go

EXECUTE AS USER = N'dbo' REVERT
go



手动修改:
1. 右键点击数据库,选“properties ”
2. 点选左侧“Options”, 在'Compatibility Level' 选 'SQL Server 2005(90)'
3. 点选左侧“Files”, 在owner里填入 'sa' 
4. OK

原创粉丝点击