PowerDesign 16.0 生成的SQL Server2000 数据库脚本时MS_Description不存在的问题解决
2017-01-09 16:18
295 查看
根据网上查询到的资料,找到了解决方法,原文出自:http://www.cnblogs.com/24tt/p/5047257.html
PowerDesign 16.0 生成的Script语句,Sql2000内,带字段备注的语句执行时存在如下错误:
PowerDesigner 无法更新或删除属性。“某某”的属性 MS_Description不存在。
MSSQLSRV2000::Script\Objects\Column\ColumnComment
Modified Column ColComment
修改Column ColumnComment模板 路径是 Database -> Edit Current DBMS 窗体 General 选项卡 下 Script -> Objects -> Column -> ColumnComment
实际上是默认生成语句存在判断错误:默认的如下():
[if exists (select 1 from sysproperties where id = object_id('[%QUALIFIER%]%TABLE%') and type = 4) begin
以上判断是该表是否已存在备注,当有2个及以上备注要添加时(如C1,C2),添加到第二个备注C2,判断系统一定存在,而紧接着需要执行删除C2,因C2都没有添加过需要删除肯定会提示“无法更新或删除属性”了。sp_dropextendedproperty
因此需要修改判断,定位到精准的该字段是否有备注,有则删除,修改为如下(红色为添加部分,SQL2000测试通过):
[if exists (select 1
from sysproperties where id = object_id('[%QUALIFIER%]%TABLE%') and smallid in(select colid from syscolumns where id = object_id('[%QUALIFIER%]%TABLE%') and name = %.q:COLUMN% and number = 0) and name='MS_Description' and type = 4 ) begin
最后贴出完整的代码:
该代码经过测试,暂时没问题。
这是修改位置
PowerDesign 16.0 生成的Script语句,Sql2000内,带字段备注的语句执行时存在如下错误:
PowerDesigner 无法更新或删除属性。“某某”的属性 MS_Description不存在。
MSSQLSRV2000::Script\Objects\Column\ColumnComment
Modified Column ColComment
修改Column ColumnComment模板 路径是 Database -> Edit Current DBMS 窗体 General 选项卡 下 Script -> Objects -> Column -> ColumnComment
实际上是默认生成语句存在判断错误:默认的如下():
[if exists (select 1 from sysproperties where id = object_id('[%QUALIFIER%]%TABLE%') and type = 4) begin
以上判断是该表是否已存在备注,当有2个及以上备注要添加时(如C1,C2),添加到第二个备注C2,判断系统一定存在,而紧接着需要执行删除C2,因C2都没有添加过需要删除肯定会提示“无法更新或删除属性”了。sp_dropextendedproperty
因此需要修改判断,定位到精准的该字段是否有备注,有则删除,修改为如下(红色为添加部分,SQL2000测试通过):
[if exists (select 1
from sysproperties where id = object_id('[%QUALIFIER%]%TABLE%') and smallid in(select colid from syscolumns where id = object_id('[%QUALIFIER%]%TABLE%') and name = %.q:COLUMN% and number = 0) and name='MS_Description' and type = 4 ) begin
最后贴出完整的代码:
[if exists (select 1 from sysproperties where id = object_id('[%QUALIFIER%]%TABLE%') and smallid in(select colid from syscolumns where id = object_id('[%QUALIFIER%]%TABLE%') and name = %.q:COLUMN% and number = 0) and name='MS_Description' and type = 4 ) begin [%OWNER%?[.O:[execute ][exec ]]sp_dropextendedproperty [%R%? ]'MS_Description', [%R%? ]'user', [%R%? ]%.q:OWNER%, [%R%? ]'table', [%R%? ]%.q:TABLE%, [%R%? ]'column', [%R%? ]%.q:COLUMN% :declare @CurrentUser sysname select @CurrentUser = user_name() [.O:[execute ][exec ]]sp_dropextendedproperty [%R%? ]'MS_Description', [%R%? ]'user', [%R%? ]@CurrentUser, [%R%? ]'table', [%R%? ]%.q:TABLE%, [%R%? ]'column', [%R%? ]%.q:COLUMN% ] end ][%OWNER%?[.O:[execute ][exec ]]sp_addextendedproperty [%R%? ]'MS_Description', [%R%? ]%.q:COMMENT%, [%R%? ]'user', [%R%? ]%.q:OWNER%, [%R%? ]'table', [%R%? ]%.q:TABLE%, [%R%? ]'column', [%R%? ]%.q:COLUMN% :select @CurrentUser = user_name() [.O:[execute ][exec ]]sp_addextendedproperty [%R%? ]'MS_Description', [%R%? ]%.q:COMMENT%, [%R%? ]'user', [%R%? ]@CurrentUser, [%R%? ]'table', [%R%? ]%.q:TABLE%, [%R%? ]'column', [%R%? ]%.q:COLUMN% ]
该代码经过测试,暂时没问题。
这是修改位置
相关文章推荐
- powerdesigner中生成数据库脚本时出现长度限制问题的解决方法
- 今天用 hbm2ddl 生成数据库脚本时,不明不白地遇到了一个问题又糊里糊涂解决了
- sql server生成脚本备份数据库——解决数据库版本不兼容问题
- 从visio数据库脚本生成添加 MS_Description 的sql脚本
- Power Designer (PD) 由物理数据模型PDM生成数据库脚本时带双引号的问题
- powerdesigner12生成的oracle脚本的带引号问题的解决
- ASP.Net生成后台脚本的问题的解决办法
- SQL1052N 数据库路径*不存在问题解决
- 彻底解决Ms sql server 2000中的最大流水号的生成问题
- SQL Server 2008 转换为 SQL 2005 数据库 脚本生成方式(解决主键、索引、标识等数据库约束丢失)
- SQL1052N 数据库路径*不存在问题错误的解决
- SQL1052N the database path does not exist 数据库路径不存在问题错误的解决
- ASP.Net生成后台脚本的问题的解决办法
- ASP.Net生成后台脚本的问题的解决办法
- Power Designer (PD) 由物理数据模型PDM生成数据库脚本时带双引号的问题
- Windows7旗舰版安装PLSQLDeveloper连接数据库遇到:ora-12514 问题和ORA-12545:因目标主机或对象不存在,连接失败”解决方法
- SQL Server 2008 转换为 SQL 2005 数据库 脚本生成方式(解决主键、索引、标识等数据库约束丢失)
- 解决realmethods生成的程序无法连接数据库的问题
- SQL Server 2008 转换为 SQL 2005 数据库 脚本生成方式(解决主键、索引、标识等数据库约束丢失)
- 解决PDM生成(DB2 数据库)的列注释脚本,在执行时报错