Composite primary key

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
via
Premium Member
Premium Member
Posts: 118
Joined: Fri Sep 23, 2005 3:10 pm

Composite primary key

Post by via »

Hi,
Can a column in a composite primary key be a null? we have a primary key with combination of 2 key columns.In those 2 key columns , can anyone be null?
Database is DB29.Does it accept? Any ideas.

Thanks
Via
-------------------------------------
Learn all the way, as you Grow each Second
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No.

(having some transmission difficulties here - moderator, please remove)
Last edited by ray.wurlod on Mon Apr 02, 2007 9:23 am, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

All primary key columns in DB2 tables must be NOT NULL.

Re-design the target table. Or use a dedicated default value.

What does it really mean that you want to make part of a key unknown? Ponder on that for a while.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
via
Premium Member
Premium Member
Posts: 118
Joined: Fri Sep 23, 2005 3:10 pm

Post by via »

Thanks Ray..
Via
-------------------------------------
Learn all the way, as you Grow each Second
via
Premium Member
Premium Member
Posts: 118
Joined: Fri Sep 23, 2005 3:10 pm

Post by via »

Hi,
I got small doubt.If a key is specified on a column, Does it mean that it is indexed as a default? And if we create index on a column, does it mean that its a key?
I appreciate any clarifications..
Thanks
Via
-------------------------------------
Learn all the way, as you Grow each Second
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

No. But usually indices are created on keys for faster updates and retrievals.

The vice versa is also not important, i.e, if an index is set on a column, it does'nt mean it is a key.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
via
Premium Member
Premium Member
Posts: 118
Joined: Fri Sep 23, 2005 3:10 pm

Post by via »

Thanks Brian..But i want to know as key is created on a column, is it indexed as well? or should we explicitly create an index on that key column.

Thanks
Via
-------------------------------------
Learn all the way, as you Grow each Second
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Indices need to be created explicitly, so yes, create them explicitly.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
via
Premium Member
Premium Member
Posts: 118
Joined: Fri Sep 23, 2005 3:10 pm

Post by via »

Thanks for the clarification..Really this DSXchange is helping a lot..
Via
-------------------------------------
Learn all the way, as you Grow each Second
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Note that the answer given relates to DB2. Some databases do automatically create an index on the primary key (though not on its individual columns).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
via
Premium Member
Premium Member
Posts: 118
Joined: Fri Sep 23, 2005 3:10 pm

Post by via »

Thanks Ray for pointing that..
Via
-------------------------------------
Learn all the way, as you Grow each Second
Post Reply