PowerDesigner 16 sql server 2008生成备注报“对象名 'sysproperties' 无效”解决办法(二)

2015-02-02 23:17:33 · 作者: · 浏览: 26
_id?=?object_id('T_PRI_CarLimitPriceCache')?
?and?minor_id?=?0)?
begin?
?declare?@CurrentUser?sysname?
select?@CurrentUser?=?user_name()?
execute?sp_dropextendedproperty?'MS_Description',?
?'user',?@CurrentUser,?'table',?'T_PRI_CarLimitPriceCache'?
?
end?
?
select?@CurrentUser?=?user_name()?
execute?sp_addextendedproperty?'MS_Description',?
?'限价设定数据缓存',?
?'user',?@CurrentUser,?'table',?'T_PRI_CarLimitPriceCache'?
go?
?
if?exists?(select?1?
?from?sys.extended_properties?
?where?major_id=?object_id('T_PRI_CarLimitPriceCache')?
?and?value?=?'店面编码')?
begin?
?declare?@CurrentUser?sysname?
select?@CurrentUser?=?user_name()?
execute?sp_dropextendedproperty?'MS_Description',?
?'user',?@CurrentUser,?'table',?'T_PRI_CarLimitPriceCache',?'column',?'MarketCode'?
?
end?
再执行的时候就不会报? [对象名 'sysproperties' 无效。]这个错误了。

现在把PowerDesigner 15里的TableComment 和 ColumnComment里的内容贴出来。
[plain]?
-------------------------TableComment-----------------------------------?
[%OWNER%?[.O:[execute?][exec?]][sys.]sp_addextendedproperty?[%R%?[@%S%=][N]]'MS_Description',?
?[%R%?[@%S%=][N]]%.q:COMMENT%,?
?[%R%?[@%S%=][N]]'[.O:[user][schema]]',?[%R%?[@%S%=][N]]%.q:OWNER%,?[%R%?[@%S%=][N]]'table',?[%R%?[@%S%=][N]]%.q:TABLE%?
:declare?@CurrentUser?sysname?
select?@CurrentUser?=?user_name()?
[.O:[execute?][exec?]][sys.]sp_addextendedproperty?[%R%?[@%S%=][N]]'MS_Description',?
?[%R%?[@%S%=][N]]%.q:COMMENT%,?
?[%R%?[@%S%=][N]]'user',?[%R%?[@%S%=][N]]@CurrentUser,?[%R%?[@%S%=][N]]'table',?[%R%?[@%S%=][N]]%.q:TABLE%?
]?
?
?
-------------------------ColumnComment----------------------------------?
?
[%OWNER%?[.O:[execute?][exec?]]sp_addextendedproperty?[%R%?[N]]'MS_Description',?
?[%R%?[N]]%.q:COMMENT%,?
?[%R%?[N]]'user',?[%R%?[N]]%.q:OWNER%,?[%R%?[N]]'table',?[%R%?[N]]%.q:TABLE%,?[%R%?[N]]'column',?[%R%?[N]]%.q:COLUMN%?
:declare?@CurrentUser?sysname?
select?@CurrentUser?=?user_name()?
[.O:[execute?][exec?]]sp_addextendedproperty?[%R%?[N]]'MS_Description',?
?[%R%?[N]]%.q:COMMENT%,?
?[%R%?[N]]'user',?[%R%?[N]]@CurrentUser,?[%R%?[N]]'table',?[%R%?[N]]%.q:TABLE%,?[%R%?[N]]'column',?[%R%?[N]]%.q:COLUMN%?
]?

修改后的PowerDesigner 16里TableComment 和 ColumnComment里的内容贴出来。
[plain]?
---------------------------------TableComment------------------------------?
[if?exists?(select?1?
?from?sys.extended_properties?
?where?major_id?=?object_id('[%QUALIFIER%]%TABLE%')?
?and?minor_id?=?0)?
begin?
?[%OWNER%?[.O:[execute?][exec?]]sp_dropextendedproperty?[%R%?[N]]'MS_Description',?
?[%R%?[N]]'user',?[%R%?[N]]%.q:OWNER%,?[%R%?[N]]'table',?[%R%?[N]]%.q:TABLE%?
:declare?@CurrentUser?sysname?
select?@CurrentUser?=?user_name()?
[.O:[execute?][exec?]]sp_dropextendedproperty?[%R%?[N]]'MS_Description',?
?[%R%?[N]]'user',?[%R%?[N]]@CurrentUser,?[%R%?[N]]'table',?[%R%?[N]]%.q:TABLE%?
]?
end?
?
?
][%OWNER%?[.O:[execute?][exec?]]sp_addextendedproperty?[%R%?[N]]'MS_Description',?
?[%R%?[N]]%.q:COMMENT%,?
?[%R%?[N]]'user',?[%R%?[N]]%.q:OWNER%,?[%R%?[N]]'table',?[%R%?[N]]%.q:TABLE%?
:select?@CurrentUser?=?user_name()?
[.O:[exec