Primary Key updateable
Primary Key updateable
(OP)
Hi,
i am new to the forum and have one first question.
I am using Pervasive.SQL and I want to update a Primary Key field by following code: (pos is the primary)
update punkteschluessel
set pos = 10
where pos = 1
;
on executing i get following execution error: The key field is not modifiable (Btrieve Error 10).
Is there a possibility to update the primary key, otherwise i would have to use a synthetic primary key?!
thanks for answers!
regards,
Thorsten
i am new to the forum and have one first question.
I am using Pervasive.SQL and I want to update a Primary Key field by following code: (pos is the primary)
update punkteschluessel
set pos = 10
where pos = 1
;
on executing i get following execution error: The key field is not modifiable (Btrieve Error 10).
Is there a possibility to update the primary key, otherwise i would have to use a synthetic primary key?!
thanks for answers!
regards,
Thorsten
RE: Primary Key updateable
CODE
insert into test (f1, f2) values (1,'1')#
insert into test (f1, f2) values (2,'2')#
insert into test (f1, f2) values (3,'3')#
update test set f1 = 5 where f1 = 3#
select * from test
I was using PSQL v10 but I believe this would be the same for PSQL 2000, v8, and v9.
Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com
RE: Primary Key updateable
You'll have to copy the record, change the primary key and delete the original record.
RE: Primary Key updateable
still don´t understand it, the table was created like this:
CREATE TABLE punkteschluessel USING 'punktes' + VersionExt
PAGESIZE 1024 PREALLOCATE 1 DCOMPRESS OWNER DataOwnerName OWNERACCESS NOENCRYPT WITH REPLACE
(PRIMARY KEY(pos),
pos INTEGER(2) (NOT NULL),
punkte INTEGER(2)
)
WITH INDEX (
punkte MOD
)
;
RE: Primary Key updateable
In your case, I'm guessing that Primary Keys were created non-modifiable in that old version of PSQL. Can you post a BUTIL -STAT output of the data file?
Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com