Post by Mr. K.V.B.L.A table has been described via DDL and has a PRIMARY KEY clause with
4 fields listed. I do a DESCRIBE TABLE function through a product
called RazorSQL (www.razorsql.com). It returns the table information
but no information about primary keys and associated constraints. Yet
inserting two rows with the same key results in a SQL0803 (-803).
Per the DDL, the duplicate key error is correct. If the "Describe
Table Tool" http://www.razorsql.com/docs/describe_table.html does not
properly populate the first and second tabs, then there is a problem
with the tooling or something wrong at the server.
Post by Mr. K.V.B.L.I can't use the DESCRIBE command in STRSQL, RUNSQLSTM and others per
the help.
The DESCRIBE is available in REXX and via embedded SQL of supported
HLLs. However I am not aware of that statement returning anything about
any CONSTRAINT definitions, so I do not think that would help at the
local\server database. The SQL Catalog VIEWs would provide that
information. The client should be getting the information about the
constraints not from a DESCRIBE at the server, but via the catalogs.
Post by Mr. K.V.B.L.Not sure what to ask here but I'd like to drop the primary key
Dropping the PRIMARY KEY can be done in STRSQL or RUNSQLSTM; e.g.
without even knowing the name of the CONSTRAINT [because there can be
only one], issue the request:
ALTER TABLE table_name DROP PRIMARY KEY
Post by Mr. K.V.B.L.but I can't through SQL since it thinks there aren't any keys on
this table at all.
The SQL client connection should be using a PrimaryKeys API which is
effectively a query of a Catalog VIEW like SYSCST to be made aware of a
PRIMARY KEY CONSTRAINT; e.g.:
select CONSTRAINT_NAME from QSYS2/SYSCST where TABLE_NAME=? and
CONSTRAINT_SCHEMA=? and CONSTRAINT_TYPE='PRIMARY KEY'
That could be used to populate the "Primary Key" information with
"true" as seen on:
http://www.razorsql.com/docs/describe_table.html
Saying "can't" is not very descriptive? What was tried? As noted
above, the request can be done on the server directly. Can that SQL
client send a user-composed ALTER request [the one shown earlier]
directly to the client, instead of for example doing something like
right-click->remove on the Primary Key shown on the Describe Table panel?
The catalogs VIEWs can be queried to verify the constraint
definitions are there. If they are there, then that suggests the issue
is more likely with the client. Beyond the prior query, also:
select COLUMN_NAME from syskeycst where TABLE_NAME=? and
CONSTRAINT_SCHEMA=?
--
Regards, Chuck