Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2006
    Posts
    15

    Unanswered: Access 2000 :How To Add Primary Key To Existing Table And Remove Indexed Key

    Hi,
    I am using Microsoft Access 2000.
    I would like to add primary key to existing table by query but i find no solution online for few days. For example, i want to make column x become a primary key.

    Table A
    Column x
    Column y Indexed =Yes(Duplicate OK)
    Column z


    My question
    1).is is it possible to add primary key to existing table with existing column by query?
    2).Or i can do it in design view only?

    My third question is
    a).is it possible to change the property of Column y by query?
    For example; The indexed is changed fromIndexed=Yes(Duplicate OK) to NO

    2).Or i can do it in design view only?

    Help Please!!

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1. The following SQL statement creates a primary key index named "Primary_Key" on the column "Column_X" of the table "Table_A":
    Code:
    CREATE INDEX Primary_Key ON Table_a (Column_X) WITH PRIMARY;
    2. The first of the following two SQL statements deletes an existing index Named "IDX_Column_Y" based on the column "Column_Y" of the table "Table_A". The second SQL statement re-creates this "IDX_Column_Y" index with an ascending sort order and prohibits Null values in this column:
    Code:
    DROP INDEX Column_Y ON Table_a;
    CREATE INDEX IDX_Column_Y ON Table_a (Column_Y ASC) WITH DISALLOW NULL;
    I'm not sure whether the SQL statement ALTER INDEX works in Access or doesn't. For more explanations search for Microsoft Jet SQL DDL (Data Definition Language) in Access Help.
    Have a nice day!

  3. #3
    Join Date
    Dec 2006
    Posts
    15
    Thanks Sinndho,
    You have help me so much !!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome !
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •