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 > A little help about 'GENERATE ALWAYS', please !

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-04, 15:37
arrebola arrebola is offline
Registered User
 
Join Date: Oct 2004
Posts: 1
A little help about 'GENERATE ALWAYS', please !

Hi all,

When creating a 'generated always' columns is it possible to have values like "ID0001", "ID0002", "ID0003" and so on ?! If so, how ?

Obs.: This column shall be my PRIMARY KEY.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 10-04-04, 04:49
hurmavi hurmavi is offline
Registered User
 
Join Date: Jan 2004
Location: Europe, Finland, Helsinki
Posts: 60
Hi Arrebola!

Sorry, "GENERATED ALWAYS" columns are allways SMALLINT, INTEGER or DECIMAL. So it's not possible to use CHAR datatype. So, anwer is no!

We have used GENERATED ALWAYS columns and we considered those to be a big mistake. The maintanance with GENERATED ALWAYS tables is really "pain in the neck".
Tables with GENERATED BY DEFAULT is somewhat easier to maintain - but not ideal either. If you have version 8 with SEQUENCEs, use those instead.


Cheers, Bill
Reply With Quote
  #3 (permalink)  
Old 10-04-04, 08:26
vidyaraok vidyaraok is offline
Registered User
 
Join Date: Aug 2004
Posts: 15
you ca have oe colum say C1 as generated always as identity(int), and second colum c2 as generated always as ('I000' || c1). form proper concatenation expression for this column
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