Archive

Posts Tagged ‘PowerDesigner’

Check Length for columns, FK and others… PowerDesigner.

June 24th, 2009 Guilherme Morais No comments
I have faced a problem, few weeks ago, someone made the reverse from a huge DB to Power Designer 12.5, something with more than 100 tables… ( huge for me of course ) I had to change the name of the FKs (References), Sequences, Trigger and Columns putting in the pattern requested, but the names was recieving more than 30 Chars. To verify that without checking one-by-one I made a “Extend Model Definition” , below you will see what I made, maybe this could help you in the future.

For References I used, this script is:

 SQL |  copy code |? 
1
FUNCTION %Check%(obj)
2
   %Check% = True
3
   IF (len(obj.ForeignKeyConstraintName)>30) Then 
4
       %Check% = false
5
   end IF
6
End FUNCTION

For Sequences I used, this script is:

 SQL |  copy code |? 
1
FUNCTION %Check%(obj)
2
<obj>   %Check% = True
3
   IF (len(obj.Code)>30) Then
4
       %Check% = false
5
   end IF
6
End Function</obj>

For Table I used, this script:

 SQL |  copy code |? 
1
FUNCTION %Check%(obj)
2
   %Check% = True
3
   IF (len(obj.name)>30) Then
4
       %Check% = false
5
   end IF
6
End FUNCTION

And for Trigger, I used:

Function %Check%(obj)
 SQL |  copy code |? 
1
   %Check% = True
2
   IF (len(obj.name)>30) Then
3
       %Check% = false
4
   end IF
5
End FUNCTION