Results 1 to 6 of 6

Thread: Define an Unique key

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    9

    Define an Unique key

    How to definie an Unique key for a field? And how to auto increase an unique key?

  2. #2
    Lianja Support Team lianjasupport's Avatar
    Join Date
    Feb 2012
    Location
    Boston USA, Wokingham UK
    Posts
    1,259
    Quote Originally Posted by Ho View Post
    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.

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    9
    Where to define an Unique key for a non-numeric field or a combination of fields?

  4. #4
    Registered User
    Join Date
    Feb 2012
    Location
    Frankfurt am Main, Germany
    Posts
    163
    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

  5. #5
    Lianja Support Team lianjasupport's Avatar
    Join Date
    Feb 2012
    Location
    Boston USA, Wokingham UK
    Posts
    1,259
    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

  6. #6
    Lianja Support Team lianjasupport's Avatar
    Join Date
    Feb 2012
    Location
    Boston USA, Wokingham UK
    Posts
    1,259
    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)

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us