cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with Alter Script generation

Former Member
0 Likes
2,236

I recently upgraded from Powerdesigner 16.0 to 16.5 and since then the generation of alter scripts for the latest changes to the data model are not running correctly.  A change to a "code" table that is referenced by many other tables fails (MS SQL Server 2008) because of the existence of a Foreign Key reference.  The tool use to generate these scripts correctly, i.e. they dropped all foreign key references and then altered the table and then recreated the foreign keys.  Not sure what has happened after the upgrade.  Does anyone else know what might have changed. 

I hope I have the correct forum, this is my first post under SAP (use to use Sybase often enough but the tool hasn't given me any trouble in a very long time).  I'll probably open a support case Monday, as this issue has only been noticed for the first time this last week but is a serious issue.  Still hoping it might be something simple that others already know.

thanks,

James K.

View Entire Topic
Former Member
0 Likes

Hi,

Here is a short summary of my problem. Power Designer tries to rename a modified table (in my case called T2). To do that, it first adds in the script a line in order to remove the primary key of this table :

alter table T2

   drop constraint PK_T2

;

There are existing foreign keys that reference this primary key and Power Designer should remove these ones first. But it does not. These lines should be :

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('T1') and o.name = 'FK_T1_T1T2_T2')

alter table T1

   drop constraint FK_T1_T1T2_T2

;

And, of course, I got the following errors :

Msg 3725, Level 16, State 0, Line 9

The constraint 'PK_T2' is being referenced by table 'T1', foreign key constraint 'FK_T1_T1T2_T2'.

Msg 3727, Level 16, State 0, Line 9

Could not drop constraint. See previous errors.

I think that it's very close to your issue and I'm sure that the last answer does not provide us any usefull information.

So any other idea ?

Thanx

Former Member
0 Likes

Thanks everyone for looking at this problem.  I have opened a support case with Customer Support but still no resolution.  I'm glad to know it isn't something unique to my system.  I had thought it might be related to one or more customization's I had made to the DBMS resource file.

If/when I get an answer from Customer Support I will post the results here also.

Thanks,

James Knowlton