Board index » delphi » Create Access Tables with Primary Keys

Create Access Tables with Primary Keys

I wrote a program using ADOExpress and a Access database. Now I create my
database and tables on the fly if not found. But I need a way to create
primary keys for these tables can anyone help me?
 

Re:Create Access Tables with Primary Keys


Look the MSAccess Help, at the CREATE help. This is from the help:

CREATE TABLE Amigos
(
[IdAmigo] Integer,
[Apellido] Text,
[Nombre] Text,
[FechaDeNacimiento] date,
[Telfono] Text,
[Nota] memo,
PRIMARY KEY ([IdAmigo])
);

Rodney Bagley <rbag...@imageright.com> escribi en el mensaje de noticias
3b2def4d_1@dnews...

Quote
> I wrote a program using ADOExpress and a Access database. Now I create my
> database and tables on the fly if not found. But I need a way to create
> primary keys for these tables can anyone help me?

Re:Create Access Tables with Primary Keys


Quote
>I wrote a program using ADOExpress and a Access database. Now I create my
>database and tables on the fly if not found. But I need a way to create
>primary keys for these tables can anyone help me?

With SQL use

ALTER TABLE tblCustomers
   ALTER COLUMN CustomerID INTEGER
   CONSTRAINT PK_tblCustomers PRIMARY KEY

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads