Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v6.0
  HXTT Cobol v3.0
  HXTT DBF v6.0
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v5.0
  HXTT Paradox v6.0
  HXTT Text(CSV) v6.0
  HXTT XML v2.0
Offshore Outsourcing
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
   
   
   
Heng Xing Tian Tai Ltd. of Beijing 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
 

Email: webmaster@hxtt.com
Copyright © 1999-2017 Heng Xing Tian Tai Ltd. of Beijing City. | All Rights Reserved. | Privacy | Legal | Sitemap