现在的位置: 首页 > 综合 > 正文

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

2013年10月29日 ⁄ 综合 ⁄ 共 691字 ⁄ 字号 评论关闭

在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

抱歉!评论已关闭.