Great idea but it doesn't seem to work; running v5r4.

Any ideas?

runsql 'ALTER TABLE jstone/bzapplprq DROP PRIMARY KEY RESTRICT'

gives error:

Table BZAPPLPRQ in JSTONE does not have a primary or unique key.
RUN QUERY command failed with SQLCODE -539.
RUN QUERY command ended due to error.
STRQMQRY command failed.

DDS:

UNIQUE
R BZAPPLPRQR
XBZ_SEQNBR 10S
...

K XBZ_SEQNBR



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: Thursday, May 02, 2013 10:21 AM
To: Midrange Systems Technical Discussion
Subject: Re: SQL Alter table: can I remove the UNIQUE attribute from a key?

You mean like this:
UNIQUE
R ABR
MYKEY 11A
MYDATA 10A
K MYKEY

INSERT INTO ROB/AB VALUES(1, 1)
1 rows inserted in AB in ROB.
INSERT INTO ROB/AB VALUES(1, 1)
Duplicate key value specified.

ALTER TABLE ROB/AB DROP PRIMARY KEY RESTRICT
Table AB in ROB does not have a primary or unique key.

ALTER TABLE ROB/AB ADD PRIMARY KEY (MYKEY)
ALTER completed for table AB in ROB.

ALTER TABLE ROB/AB DROP PRIMARY KEY RESTRICT
ALTER completed for table AB in ROB.

INSERT INTO ROB/AB VALUES(1, 1)
1 rows inserted in AB in ROB.

Summary: Yes. Even though it already has a primary key ADD the
constraint with SQL and then delete the constraint with SQL and it drops
the primary key.


Rob Berendt

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.