| Author |
Topic |
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2006-07-06 : 13:59:18
|
| I designed a database and now as we are in the stage of extracting the script out of Erwin and we have a template which enforces the primary key as xpk_%Substitute(%EntityName,%substr(' ',2,1),_)_%PK()In the above case if we have one primary key like tbl_employee have emp_id only then it creates a primary key as xpk_tbl_employee_emp_id where as if i have composite key like emp_details_id,emp_id,emp_ssn for tbl_emp_details table thenit would show as xpk_tbl_emp_details_emp_details_id________________emp_id_____________emp_ssn Is there any better naming convention I can use for the composite keysbecause this big under score kills me sometimes the keys even gets trimmed off. |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-06 : 14:20:41
|
| Here is our naming convention:Primary key: PK_TableNameIndex: IDX_Column1_Column2_...Foreign key: FK_ParentTableName_ChildTableNameI can provide more if needed.I prefer that the constraints and indexes be descriptive so that I know more information about it when I get an error. Tara Kizeraka tduggan |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-06 : 14:27:48
|
What's DB2? Just kidding! Tara Kizeraka tduggan |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-07-07 : 01:25:05
|
| http://vyaskn.tripod.com/object_naming.htmMadhivananFailing to plan is Planning to fail |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2006-07-07 : 04:18:51
|
| Something like this:PK_tableNamePK_tableName__col1_col2 (composite primary key)IX_tableName__col1_col2_col3UIX_tableName__col1_col2_col3UC_tableName__col1_col2_col3FK_tableName_REF_tableName__cola_colb__cola_colb (not always enforced, and a shorter version is used.. hm)rockmoose |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-07-07 : 11:17:16
|
quote: Originally posted by X002548 Well, when your in DB2 and limited to 18 bytes, it's kind of a pain.Also, even though DB2 allows 18 for indexes, the underlying VSAM datasets are limited to 8 bytes so you have to watch for dupsHope I didn't scare anyoneBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam
Why do you work with pre-industrial software?CODO ERGO SUM |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2006-07-07 : 11:45:00
|
quote: Why do you work with pre-industrial software?
Because it will run on his abacus?Help us help YOU!Read this blog entry for more details: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx*need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected) |
 |
|
|
|