PowerDesigner生成MS SQL foreign的问题

conis 2009-05-11 07:14:03
简单地说,就是从CDM生成PDM的时候,releationship约束无效,不能生成外键约束的代码。生成基于oracle的pdm没问题,ms sql server有问题。

当从CDM转到PDM(MS SQL Server)的时候,在CDM中的ReleationShip不能在CDM的foreign生成有效代码,References的Privew标签显示内容为:
-- The preview is empty because of the setting.
-- Check the generation option.
查看integrity标签,implementation显示为trigger,update/delete constraint分别为restrict,改变为update/delete constraint为none,并且改implementation为declarative后,preview中代码显示正常,如下:
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('meb_FriendRequest') and o.name = 'FK_MEB_FRIE_RS_MEMBER_MEB_MEMB')
alter table meb_FriendRequest
drop constraint FK_MEB_FRIE_RS_MEMBER_MEB_MEMB
go

alter table meb_FriendRequest
add constraint FK_MEB_FRIE_RS_MEMBER_MEB_MEMB foreign key (Member_ID)
references meb_Member (Member_ID)
go


根据提示,在创建pdm的时候查看选项,发现for sql server与for oracle内容不一样。

请问高手如何解决?
...全文
154 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
conis 2009-05-12
  • 打赏
  • 举报
回复
希望有会的朋友帮帮忙,呵呵
实验步骤:
1.建立一个cdm
2.建立两个实体,分别是parent和child,并且在这两个实体中间建立一对多的relationship。
3.将cdm生成for oracle 10g的pdm,查看child表的外键约束,在标签preview中可以看到创建外键约束的代码
4.将cdm生成for ms sql 2005的pdm,要看child表的外键约束,在标签preview中可以看到如下提示:
-- The preview is empty because of the setting.
-- Check the generation option.

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧