Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT DBF
sql error when inserting into table with compound primary key
Rob Gansevles
2009-02-23 05:34:49.0
Hi,

I get an sql error when I insert a few rows in a table with composite primary keys.
Am I doing something wrong?
Is this even supported in the dbf driver?

See the sql below.

Thanks

Rob


create table tst (id1 integer not null, id2 integer not null, val integer not null, primary key (id1, id2))
insert into tst (id1, id2, val) values (1, 2, 0)
insert into tst (id1, id2, val) values (1, 3, 0)
insert into tst (id1, id2, val) values (2, 2, 0)
Re:sql error when inserting into table with compound primary key
HXTT Support
2009-02-23 06:29:30.0
But Xbase doesn't support composite primary keys. primary key (id1, id2) will become id1+id2.

create table tst (id1 varchar(11) not null, id2 varchar(11) not null, val integer not null, primary key (id1, id2))
insert into tst (id1, id2, val) values (1, 2, 0)
insert into tst (id1, id2, val) values (1, 3, 0)
insert into tst (id1, id2, val) values (2, 2, 0)

or

create table tst (id1 varchar(11) not null, id2 varchar(11) not null, val integer not null)
create index primary_key on tst (LPAD(id1,11)+LPAD( id2,11) UNIQUE)
insert into tst (id1, id2, val) values (1, 2, 0)
insert into tst (id1, id2, val) values (1, 3, 0)
insert into tst (id1, id2, val) values (2, 2, 0)




Re:Re:sql error when inserting into table with compound primary key
HXTT Support
2009-02-23 06:31:30.0
Sorry, for second sample, you can use int type:
create table tst (id1 int not null, id2 int not null, val integer not null)
create index primary_key on tst (LPAD(id1,11)+LPAD( id2,11) UNIQUE)
insert into tst (id1, id2, val) values (1, 2, 0)
insert into tst (id1, id2, val) values (1, 3, 0)
insert into tst (id1, id2, val) values (2, 2, 0)

Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap