| Author |
how to check whether the column is set to primary key ?
|
Alvin chew
Ranch Hand
Joined: Jan 08, 2004
Posts: 834
|
|
|
hi, how do we use coding to check whether the column have set to primary key ? thank you !
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
A PK is a database constraint. You cannot insert null into it. So the check is implicit to its purpose, and performed by teh DB. If you are worried about trying to run JDBC code which might be inserting nulls into PK fields, just check for nulls as you would normally before trying to run the code.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Alvin chew
Ranch Hand
Joined: Jan 08, 2004
Posts: 834
|
|
thank you, paul for reply .. can we unset the primary key in column which already set as primary key ? thank you !
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Just remove the constraint in the DDL.
|
 |
Stefan Wagner
Ranch Hand
Joined: Jun 02, 2003
Posts: 1923
|
|
A not-null column needn't be a primary key, while a primary key might not be null. start: (catalog, schema, table as String), catalog and schema may be null. See the javadocs for DatabaseMetaData for more detailed information.
|
http://home.arcor.de/hirnstrom/bewerbung
|
 |
 |
|
|
subject: how to check whether the column is set to primary key ?
|
|
|