Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2002
    Posts
    25

    Unanswered: Inserting explicit values in identity columns

    How do we insert explicit values in identity columns?
    In SQL Server this is supported by setting IDENTITY_INSERT property to OFF? Is there something similar in DB2?

  2. #2
    Join Date
    Feb 2002
    Posts
    16
    Hi ,
    In Db2 if the Identity column is created with the option 'generate ALways ' then you cannot give value for the column .If its with the option By default ,DB2 allows you to give value for it.

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Inserting explicit values in identity columns

    And it is advisable to create an index on the identity column to avoid duplication of values in the identity column.

    Don't know how it works on SQL Server, but on DB2 it works as follows :

    You allow DB2 to generate the identity column for the first three rows , then you explicity INSERT value 4 and 5 into the column. The next time DB2 inserts the value by default, you'll have another rows with the identity column as 4.

    HTH

    Cheers

    Sathyaram

    Originally posted by vdesai
    How do we insert explicit values in identity columns?
    In SQL Server this is supported by setting IDENTITY_INSERT property to OFF? Is there something similar in DB2?

  4. #4
    Join Date
    Jul 2002
    Posts
    25
    Thanks a lot. That really helped!

Posting Permissions

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