Board index » delphi » Can't create primary index in local sql

Can't create primary index in local sql

When I try to create the table below I get a 'number is out of range'
error. If I delete the primary key line it runs fine. Other creates I
made can create the table with primary key just fine.

Can anyone see anything wrong with this?

I'm using Delphi 2.01 and bde 4.51.

create table "beneficiario.db"
(
  cod_financ        smallint,  
  titular           integer   ,
  viacartao         smallint  ,
  dep               smallint  ,
  digito            char(01)  ,
  apellido          char(20)  ,
  nombre            char(20)  ,
  nomb_apell        char(28)  ,
  cod_deleg         char(10)  ,
  nro_sindic        char(15)  ,
  marca_alta_provis char(01)  ,
  fecha_ingresso    date      ,
  fecha_baja        date      ,
  cod_habil         char(01)  ,
  marca_excp_caren  char(01)  ,
  fecha_nasc        date      ,
  cod_tipo_doc      char(1)   ,
  nro_doc           integer   ,
  sexo              char(01)  ,
  cod_plan          char(03)  ,
  marca_plan_mat_inf char(01) ,
  cod_perfil_benef  char(04) ,
  dom_calle       varchar(30) ,
  dom_numero      integer     ,
  dom_piso        smallint    ,
  dom_depart      varchar(2)  ,
  dom_cod_post    smallint    ,
  dom_localid     varchar(20) ,
  dom_provincia   varchar(20) ,
  cod_provincia   char(2)     ,
  categoria       char(1)     ,
  tipo            char(1)     ,
  fecha_venc      date        ,
  q_renovacion    smallint    ,
  stamp_term      char(8)     ,
  stamp_user      char(8)      ,
  stamp_fecha     date         ,
  stamp_hora      char(8),
  primary key(cod_financ, titular, dep)

);

 

Re:Can't create primary index in local sql


Quote
Alejandro Dobniewski wrote:

> When I try to create the table below I get a 'number is out of range'
> error. If I delete the primary key line it runs fine. Other creates I
> made can create the table with primary key just fine.

Hi,

In paradox, the primary key fields must appear in order at the start of
the table. Move the definition of "viacartao" after "dep" and your
primary index should be OK.

Sean

Re:Can't create primary index in local sql


Thank you! It seems to me that the error menssage is wrong. Given the
experience of Borland in compiler tech. they could build better error
checking into their sql.

Quote
Sean McCall wrote:

> Alejandro Dobniewski wrote:

> > When I try to create the table below I get a 'number is out of range'
> > error. If I delete the primary key line it runs fine. Other creates I
> > made can create the table with primary key just fine.

> Hi,

> In paradox, the primary key fields must appear in order at the start of
> the table. Move the definition of "viacartao" after "dep" and your
> primary index should be OK.

> Sean

Other Threads