Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Pervasive.SQL > Error Creating New Table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-18-08, 08:10
ohiocowboy ohiocowboy is offline
Registered User
 
Join Date: Jun 2006
Posts: 11
Error Creating New Table

The following generates an error "The record has a key field containing a duplicate value(Btrieve error 5).
CREATE TABLE Temp1 USING 'Temp1.DAT' (PBID IDENTITY, CustID Char(20))

The following do not create an error

CREATE TABLE Temp1 USING 'Temp1.DAT' (PBID INTEGER, CustID Char(20))
or
CREATE TABLE Temp1 USING 'Temp1.DAT' (PBID CHAR(3), CustID Char(20))

I have tried changing the name to XXXXZZZ and I get the same error-no matter what table name I try to add.

Any reason why is using the data type IDENTITY generating an error?

This is an ongoing problem-every time the ERP software is upgraded I need to add my tables back into the DDFs. This time I can't.???:
Reply With Quote
  #2 (permalink)  
Old 07-18-08, 08:23
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 813
Do the data files exists? If so, you should add the "IN DICTIONARY" clause to the statement. Also, when the ERP system is updated do all of the DDFs get updated (FILE.DDF, FIELD.DDF, INDEX.DDF as a start)?
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #3 (permalink)  
Old 07-18-08, 08:33
ohiocowboy ohiocowboy is offline
Registered User
 
Join Date: Jun 2006
Posts: 11
The data files exist - disconnected from the ERP
When they upgrade they send us all new DFFs

Will the In Dictionary just add the table definition to the DDFs?
Right now I create the empty table then replace it with the populated table
Reply With Quote
  #4 (permalink)  
Old 07-18-08, 08:36
ohiocowboy ohiocowboy is offline
Registered User
 
Join Date: Jun 2006
Posts: 11
I added the clause
CREATE TABLE Temp1 IN DITIONARY USING 'Temp1.DAT' (PBID IDENTITY, CustID Char(20))

I receive the same error message with the clause.
Reply With Quote
  #5 (permalink)  
Old 07-18-08, 09:49
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 813
Hmm. It sounds like you've got some problems with the DDFs. You might want to contact the ERP vendor to make sure you have the best DDFs and that there aren't any problems.

Quote:
Will the In Dictionary just add the table definition to the DDFs?
Yes, the IN DICTIONARY clause only adds the table definition to the DDFs. It does not affect the existing data file.
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #6 (permalink)  
Old 07-18-08, 11:14
ohiocowboy ohiocowboy is offline
Registered User
 
Join Date: Jun 2006
Posts: 11
OK thanks.
To be clear: If I use the In Dictionary, it connects the existing tables to the Pervasive DB? I won't have to swap the dat files around the way I have been?

Thanks again for your help.
Reply With Quote
  #7 (permalink)  
Old 07-19-08, 08:06
ohiocowboy ohiocowboy is offline
Registered User
 
Join Date: Jun 2006
Posts: 11
I've been trying to isolate the problem. So far I know that if I reinstall the original File and Field DDFs I can add 1 new table with the first field as an Identity data type. When I try to add a second table with a different name and an Identity data type, I get the "btrieve error 5 - trying to add a duplicate record..." I can add an Integer or Char data type. I have tried adding the table using the Pervasive Control Center, VB, VBA - no luck. Any ideas on how to fix this? I have 8 tables with the first field an Identity data type.
Thanks
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On