Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2008
    Posts
    16

    Unanswered: There is no unique index in the table

    Hello Experts,
    Hope all are doing good.
    I am quite new to DB.
    I am using java swings and SQL Server Management Studio Express (2).

    I want one new table in my DB suppose table B which must be like one existing table A.

    So for that I created one table with the same columes and same datatype as in table A.

    and In the java page I changed table A name by table B.
    But I this doesn't work in a right matter.

    It gives me the error that "there is no unique index in the table".
    How to prodive that?
    Please suggest me that my approach is right or not.
    If it is so then how to create unique index.

    Thanks..

  2. #2
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    You should generally specify the keys using a PRIMARY KEY or UNIQUE constraint when you create the table. You can add a key using the ALTER TABLE statement which also creates the index. For example:

    ALTER TABLE tbl ADD CONSTRAINT tbl_pk PRIMARY KEY (col1);

Posting Permissions

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