cancel
Showing results for 
Search instead for 
Did you mean: 

Naming convention for Primary Key

Former Member
0 Kudos


Hi

I am using PD 16.5.3.3 and the database is set to DB2. I am generating the DDL for my tables.  The syntax for primary key comes something like this:

"P_Identifier_1"

How do i change this to say <TABLE>_PK; as an example, if I have employee table, it should say EMPLOYEE_PK

thank you

krishna

Accepted Solutions (1)

Accepted Solutions (1)

marc_ledier
Active Participant
0 Kudos

Hi,

You can change it in the DBMS definition file (make a copy first).

Browse to <DBMSCode>::Script\Objects\PKey\ConstName

You can see the value "P_%.16:PKEY%"

which takes the 16 first characters of Primary Key code and prefix it with P_

You can change this value with

%.15:TABLE%_PK, taking the 15 first character of table code + adding suffix _PK

The size limitation is imposed by DB2 (18 characters), if I remember correctly.

Note that the keys for which you manually changed the constraint names will not take the new template, you will need to revisit them and click (pull ?) the user-defined button on the right of the constraint name field.

Marc

Former Member
0 Kudos

Thank you Mark.

My DBA wants the indexes to be generated as 'X_N<n>_TableName; so as an example, if I have an employee table with 3 indexes on it, they should appear like:

X_N1_EMPLOYEE

X_N2_EMPLOYEE

X_N3_EMPLOYEE

I have changed the format on the "PDM Generation Options" page on the Detail tab and set the index format as X_N_%TABLE%'; Now it is generating indexes as :

X_N_EMPLOYEE1

X_N_EMPLOYEE2

X_N_EMPLOYEE3

is there any way i change the format string to generate it the way I am looking for?

phsilva
Explorer
0 Kudos

Hi Krishna,

I guess you can find the answer for you second question in the following thread:

Hope this helps

Regards,

-Paulo

GeorgeMcGeachie
Active Contributor
0 Kudos

I'm not in a position to check at the moment, but if there's a property of an index that indicates its position in the collection of sequences, you could use that in the template - it'll probably start from 0, so you'll have to add 1 to it.

You can check the properties in the metamodel help for indexes.

Answers (0)