在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