Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Posts
    3

    Unanswered: Retrieving Identity Value

    I am rather new to DB2 (SQL Server guy) and haven't been able to figure out how to easily retrieve the identity value of a new record added using ADO .NET.

    Is there a simple function call that can be made or a way to return the value when the record is added?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Bob,
    You can issue the following query immediately after the insert:

    SELECT IDENTITY_VAL_LOCAL() from SYSIBM.SYSDUMMY1;

    Note: you must issue the above before any other inserts and before any COMMITs.

    HTH

    Andy

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    This function IDENTITY_VAL_LOCAL() is specific to a session ...

    HTH

    Cheers

    Sathyaram

    Originally posted by ARWinner
    Bob,
    You can issue the following query immediately after the insert:

    SELECT IDENTITY_VAL_LOCAL() from SYSIBM.SYSDUMMY1;

    Note: you must issue the above before any other inserts and before any COMMITs.

    HTH

    Andy

Posting Permissions

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