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 > equivalent of SERIAL for DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-05-04, 05:10
geoffrey geoffrey is offline
Registered User
 
Join Date: Jun 2004
Posts: 39
equivalent of SERIAL for DB2

I'm wondering if an equivalent of the type SERIAL exists in DB2 (V7 or V8).

Thanks for your help
__________________
geoffrey
- Four J's Development Tools -
Reply With Quote
  #2 (permalink)  
Old 07-05-04, 05:29
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Hi geoffrey,

Please read Must Read before posting

Grofaty
Reply With Quote
  #3 (permalink)  
Old 07-05-04, 05:43
geoffrey geoffrey is offline
Registered User
 
Join Date: Jun 2004
Posts: 39
(same player play again)

I'm using DB2 V7 and V8 on different Unix system (AIX, Sun, Linux,...).

SQL offers the possibility of defining a data type SERIAL
(SERIAL(n) : The SERIAL data type stores a sequential integer assigned automatically by the database server when a row is inserted. A SERIAL data column is commonly used to store unique numeric codes (for example, order, invoice, or customer numbers). SERIAL data values require 4 bytes of storage.)

And I'm wondering if there is an equivalent of this type in DB2. (GENERATED ALWAYS ???).

Thanks in advance
__________________
geoffrey
- Four J's Development Tools -
Reply With Quote
  #4 (permalink)  
Old 07-05-04, 06:48
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
There are two options, IDENTITY and SEQUENCE ...

There is an article comparing these two types in developer domain www7b.boulder.ibm.com/dmdd ...

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 07-05-04, 08:12
geoffrey geoffrey is offline
Registered User
 
Join Date: Jun 2004
Posts: 39
Thx for your help, i'll use GENERATED BY DEFAULT AS IDENTITY in my tests.
__________________
geoffrey
- Four J's Development Tools -

Last edited by geoffrey; 07-05-04 at 08:25.
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