Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.1
  HXTT Cobol v5.0
  HXTT DBF v7.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v6.1
  HXTT Json v1.0
  HXTT Paradox v7.1
  HXTT PDF v2.0
  HXTT Text(CSV) v7.1
  HXTT Word v1.1
  HXTT XML v4.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 Lab of Xi'an City (abbr, HXTT)

HXTT DBF
sql error when inserting into table with compound primary key
Rob Gansevles
2009-02-23 05:34:49
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
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
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 © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap