PDA

View Full Version : Define an Unique key



Ho
2012-08-16, 09:12
How to definie an Unique key for a field? And how to auto increase an unique key?

lianjasupport
2012-08-16, 09:30
How to definie an Unique key for a field? And how to auto increase an unique key?

Hello Ho, you can use the AUTOINC column constraint when creating your table.

Ho
2012-08-17, 04:29
Where to define an Unique key for a non-numeric field or a combination of fields?

lazyfox
2012-08-17, 07:29
in vfp you would define an index of type candidate. Lokking through Lianja docs on "index",
candidate is not mentioned yet and errors in current refresh,
but Unique and Set unique on/off are metnioned in the docs on index.

Or try through standard SQL language or documented Recital SQL
with the Alter table command. Currently no time to play myself ;-)

HTH

thomas

lianjasupport
2012-08-17, 08:43
Just use the INDEX ON command and the UNIQUE keyword, e.g. in the Console:

open database southwind
use employees
index on trim(lastname)+" "+firstname unique tag fullname

lianjasupport
2012-08-17, 08:45
Or in SQL, specify the UNIQUE keyword in the CREATE INDEX command, e.g. in the Console:

create unique index sqlfullname on employees (trim(lastname)+" "+firstname)