首页 技术 正文
技术 2022年11月10日
0 收藏 745 点赞 4,630 浏览 1342 个字

PowerDesinger16创建数据库表到SQL2008R2时,执行报“对象名sysproperties无效”错误。

主要是在建模时我们对表、列增加了些说明注释,而Sql2005之后系统表sysproperties已废弃删除而改用sys.extended_properties所致。

此问题解决主要参考了http://hi.baidu.com/xuefliang/item/45e7f71421d5a67871d5e8e2

1、修改Table TableComment模板

路径是 Database -> Edit Current DBMS 窗体 General 选项卡 下 Script -> Objects -> Table –> TableComment

[if exists (select 1
from sys.extended_properties
where major_id = object_id('[%QUALIFIER%]%TABLE%')
and minor_id = 0 )
/* SQL2008 属性表sysproperties改为 sys.extended_properties代替,替换以下脚本
[if exists (select 1
from sysproperties
where id = object_id('[%QUALIFIER%]%TABLE%')
and type = 3)
*/

2、修改Column ColumnComment模板

路径是 Database -> Edit Current DBMS 窗体 General 选项卡 下 Script -> Objects -> Column –> ColumnComment

[if exists (select 1
from sys.extended_properties
where major_id = object_id('[%QUALIFIER%]%TABLE%')
and minor_id <> 0 and name = 'MS_Description')
/* SQL2008 属性表sysproperties改为 sys.extended_properties代替,替换以下脚本
if exists (select 1
from sysproperties
where id = object_id('[%QUALIFIER%]%TABLE%')
and type = 4)
*/

也可创建sysproperties视图来,通过此视图处理以上问题。

 if exists (select 1
from sysobjects
where name = 'sysproperties'
and xtype = 'V')
begin
DROP VIEW sysproperties
end
GO CREATE VIEW sysproperties
AS
SELECT A.name As TableName,A.id As TableID,B.Name As ColName,B.colid As ColID,B.xtype As ColType,C.name As PropName,C.Value As PropValue
FROM sysobjects As A
INNER JOIN syscolumns As B ON A.id = B.id
INNER JOIN sys.extended_properties As C ON C.major_id = A.id AND ( minor_id = B.colid)
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,154
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,623
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,465
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,239
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,874
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,042