Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Primary Key updateable

Primary Key updateable

Primary Key updateable


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!


RE: Primary Key updateable

How was your table created?  If your table was created with a non-modifiable index,you will get the error 10 as you are seeing.  A Primary Key is modifiable by default.  I ran the following and was able to update the table:


create table test (f1 int primary key, f2 char(100))#
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.  

Certified Pervasive Developer
Certified Pervasive Technician

RE: Primary Key updateable

Sage Accpac, for example, creates non-modifiable keys on their databases.

You'll have to copy the record, change the primary key and delete the original record.

RE: Primary Key updateable

sry for my responsing so late!

still don´t understand it, the table was created like this:

CREATE TABLE punkteschluessel USING 'punktes' + VersionExt

  (PRIMARY KEY(pos),
  pos                      INTEGER(2) (NOT NULL),
  punkte                   INTEGER(2)
    punkte                MOD

RE: Primary Key updateable

Wow, I haven't seen that syntax for Pervasive in a long time.  That syntax is not supported with PSQL 2000 or later.  It was only supported with the (very) old Scalable SQL.  
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?   

Certified Pervasive Developer
Certified Pervasive Technician

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close