CreateTable AND PrimaryKey

CreateTable AND PrimaryKey

Postby vilian » Thu Aug 08, 2024 2:33 pm

Hi Guys,

How could i create a mysql table and at the same time define its primarykey? Is it possible?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 977
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: CreateTable AND PrimaryKey

Postby vilian » Thu Aug 08, 2024 4:47 pm

Answering myself :)

I already found out it. Just add "PRI" in the struct.

Eg: aFld := {{"COD","C",3,0,"PRI"},{"NOME","C",30,0}}

oCn:CreateTable("test", aFld), will create the table "test" and set the field "COD" as your primary key.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 977
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: CreateTable AND PrimaryKey

Postby nageswaragunupudi » Fri Aug 09, 2024 2:37 am

Yes
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 44 guests