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 > Altering a column ...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-06, 15:43
Kota Kota is offline
Registered User
 
Join Date: Jun 2003
Posts: 113
Altering a column ...

Hi, Any problem wit hthe syntax below:

ALTER TABLE WSI.DATAFEED ALTER COLUMN CAT_ID SET GENERATED AS IDENTITY (START WITH 1000 INCREMENT BY 1 CACHE 5)

Does the table have to be in check pending before alter statement is run?

Thnx
Reply With Quote
  #2 (permalink)  
Old 09-22-06, 16:24
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The syntax look OK. This should alter the column to always generate the identity value on insert. Make sure this is what you want/need. I do not think the table needs to be in a check pending state.

Andy
Reply With Quote
  #3 (permalink)  
Old 09-22-06, 16:28
Kota Kota is offline
Registered User
 
Join Date: Jun 2003
Posts: 113
This keeps throwing messages.

DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "GENERATED AS IDENTITY (START WITH 1000" was
found following "ER COLUMN CAT_ID SET". Expected tokens may include:
"<space>". SQLSTATE=42601
Reply With Quote
  #4 (permalink)  
Old 09-22-06, 16:32
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What DB2 version and OS?

Andy
Reply With Quote
  #5 (permalink)  
Old 09-22-06, 16:38
Kota Kota is offline
Registered User
 
Join Date: Jun 2003
Posts: 113
Its DB2 8.1 fix12 on AIX 5.2 fix6
Reply With Quote
  #6 (permalink)  
Old 09-22-06, 16:50
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I do not know what the problem is. I just ran the following successfully:

ALTER TABLE ANDY.CITIES ALTER COLUMN CODE SET GENERATED AS IDENTITY ( START WITH 0 INCREMENT BY 1 NO CACHE ) ;

Andy
Reply With Quote
  #7 (permalink)  
Old 09-22-06, 16:59
Kota Kota is offline
Registered User
 
Join Date: Jun 2003
Posts: 113
Thanks for checking. I'll try another server. What db2 level are u at? Is it AIX?
Reply With Quote
  #8 (permalink)  
Old 09-22-06, 17:15
Kota Kota is offline
Registered User
 
Join Date: Jun 2003
Posts: 113
Thanks. It works. My mistake. A typo.
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