Results 1 to 2 of 2

Thread: sorry one more question

  1. #1
    jung Guest

    sorry one more question


    table : abc

    no (primary key) name
    ================ ====
    1 jung
    2 love
    4 tom


    In this record, I wanted to update no 4 to 3 which is primary key.
    So, I used the query as below.
    =============================
    Set Identity_insert abc on

    UPDATE abc
    SET no = 3
    WHERE no = 4

    Set Identity_insert abc off
    go
    =============================
    But I got an error;
    Server: Msg 8106, Level 16, State 1, Line 1
    Table 'abc' does not have the identity property. Cannot perform SET operation.

    Why this happens? I really want to update the primary key.

  2. #2
    Kurt Guest

    sorry one more question (reply)

    Jung,
    Take a look at your table. It looks like you don't have an identity column
    defined for "no" (your column name). Set Indentity_Insert doesn't work for tables that don't have one defined. PS A primary key is not the same as an Idendtity column.


    ------------
    jung at 6/22/01 9:49:34 PM


    table : abc

    no (primary key) name
    ================ ====
    1 jung
    2 love
    4 tom


    In this record, I wanted to update no 4 to 3 which is primary key.
    So, I used the query as below.
    =============================
    Set Identity_insert abc on

    UPDATE abc
    SET no = 3
    WHERE no = 4

    Set Identity_insert abc off
    go
    =============================
    But I got an error;
    Server: Msg 8106, Level 16, State 1, Line 1
    Table 'abc' does not have the identity property. Cannot perform SET operation.

    Why this happens? I really want to update the primary key.

Posting Permissions

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