Results 1 to 3 of 3

Thread: What is an identity column? how can define it?

  1. #1
    jung Guest

    What is an identity column? how can define it?


    One more silly question,

    What is an identity column? how can I define it?

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

    In this example, I want to define 'no' as an identify column so that I can update it as I wish.

    Thanks in advance,


    -----------------------------------------------------------------------------
    Subject:
    From:
    Date: sorry one more question (reply)
    Kurt ()
    6/23/01 2:48:32 AM

    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.



  2. #2
    Paul Guest

    What is an identity column? how can define it? (reply)

    You must set the number column to be an identity column. Go into the tables design and set it there


    ------------
    jung at 6/23/01 12:08:57 PM


    One more silly question,

    What is an identity column? how can I define it?

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

    In this example, I want to define 'no' as an identify column so that I can update it as I wish.

    Thanks in advance,


    -----------------------------------------------------------------------------
    Subject:
    From:
    Date: sorry one more question (reply)
    Kurt ()
    6/23/01 2:48:32 AM

    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.



  3. #3
    Rajesh Guest

    What is an identity column? how can define it? (reply)

    Identity column is a kind of sequence number column. In the design page of table you can set only one column in a table as the identity column. You can set the initial value and the increment value. Aftre this whenever a row is inserted into the table the identity column gets the next value determined by increment seed.

    I don't understand your requirement of updating an identity column. Normally this column gets values automatically.




    ------------
    Paul at 6/23/01 3:50:49 PM

    You must set the number column to be an identity column. Go into the tables design and set it there


    ------------
    jung at 6/23/01 12:08:57 PM


    One more silly question,

    What is an identity column? how can I define it?

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

    In this example, I want to define 'no' as an identify column so that I can update it as I wish.

    Thanks in advance,


    -----------------------------------------------------------------------------
    Subject:
    From:
    Date: sorry one more question (reply)
    Kurt ()
    6/23/01 2:48:32 AM

    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
  •