If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Identity column "next value"

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-26-04, 11:40
winterb winterb is offline
Registered User
 
Join Date: Jun 2004
Posts: 16
Question Identity column "next value"

We are using db2 UDB version 8.2 on Linux.

Can anyone tell me where the next value for an identity column is held? I can't find it anywhere in the catalog. There are a lot of fields that are related to it but I cannot find where the value is kept.

Thanks in advance
Bob.
Reply With Quote
  #2 (permalink)  
Old 10-27-04, 07:24
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
Jayanta, Xansa India

The next value isnot stored in any catalog. It is in the table definition itself from where you have to decide the last value of the identity column and what would be its next increment.

Like : in the DDL>
"col1" integer generated always as identity (start with 100 increment by 1)
Reply With Quote
  #3 (permalink)  
Old 10-27-04, 09:25
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
In V7 look at MAXASSIGNEDVALUE in the SYSSEQUENCES table. I am not sure if it's the same for V8 but you might check it out.
Reply With Quote
  #4 (permalink)  
Old 10-27-04, 09:33
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
In v8 the column name is LASTASSIGNEDVAL.
Reply With Quote
  #5 (permalink)  
Old 10-27-04, 10:07
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Quote:
Originally Posted by n_i
In v8 the column name is LASTASSIGNEDVAL.
Caution that this is the last value cached, not neccessarily assigned... name is a little misleading.

jono
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #6 (permalink)  
Old 10-27-04, 10:34
winterb winterb is offline
Registered User
 
Join Date: Jun 2004
Posts: 16
Thanks for the info

Thanks for the info, I was looking in the worng place. It's not part of the syscat.syssequences view.

I'm not going to use it for anything, I just wanted to know where it was. I knew it had to be somewhere.

Thanks again.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On