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 > How to load this Table ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-18-06, 10:41
sudheerkumars sudheerkumars is offline
Registered User
 
Join Date: Apr 2006
Posts: 4
Angry How to load this Table ?

Hi ,

I'm trying to load this table and getting error.

Here is Table Def.

------------------------------------------------
-- DDL Statements for table "COS "."TCOSI010"
------------------------------------------------

CREATE TABLE "COS "."TCOSI010" (
"POLICY_NBR" DECIMAL(8,0) NOT NULL GENERATED ALWAYS AS IDENTITY (
START WITH +1
INCREMENT BY +1
MINVALUE +1
MAXVALUE +99999999
NO CYCLE
CACHE 20
NO ORDER ) )
IN "SCOSI010" ;

Here is the error I'm getting

SQL3550W The field value in row "F0-1" and column "1" is not NULL, but the
target column has been defined as GENERATED ALWAYS.

thanks for looking in to this,

Sudheer

sudheerkumars@yahoo.com
Reply With Quote
  #2 (permalink)  
Old 04-18-06, 11:30
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Sudheer,
Using "GENERATE ALWAYS" means that only DB2 can supply the values for the column. They cannot come from outside. If you change it to "GENERATE BY DEFAULT" then you should get what you want.

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 04-18-06, 15:20
sudheerkumars sudheerkumars is offline
Registered User
 
Join Date: Apr 2006
Posts: 4
Smile 'modified by identityoverride' option works

Thanks for your help.

I tried following option and it worked.

load from /db2backup/db2move/COS_TCOSI010exp.ixf of ixf modified by identityoverride
replace into COS.TCOSI010;

Thanks,

Sudheer
Reply With Quote
  #4 (permalink)  
Old 04-18-06, 15:27
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Sudheer,
After you load the data, you will need to alter the starting value of the identity. Otherwise when you try to insert new rows and have DB2 supply the value, you will get duplicate errors. Use ALTER TABLE Mytable ALTER column MyIdentityCol RESTART WITH x. Wherre x is some value larger that one already there.

Andy
Reply With Quote
  #5 (permalink)  
Old 04-19-06, 12:55
sudheerkumars sudheerkumars is offline
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks Andy,,,, Now it works perfect
Reply With Quote
  #6 (permalink)  
Old 04-26-06, 01:14
dileep saxena dileep saxena is offline
Registered User
 
Join Date: Apr 2006
Posts: 2
Dear friends
please tell me how we update datatype in db2.
write me query
Reply With Quote
  #7 (permalink)  
Old 04-26-06, 01:24
dileep saxena dileep saxena is offline
Registered User
 
Join Date: Apr 2006
Posts: 2
hello friends
i want to know how i update column datatype in db2.
and any diffrence from oracle regarding to this question

i wait for reply from any boddy
Reply With Quote
  #8 (permalink)  
Old 04-26-06, 15:47
schintala schintala is offline
Registered User
 
Join Date: Apr 2005
Location: USA
Posts: 119
Please let us know the OS and DB2 vesion. Prior to version 7 you will not be able to change from one data type to another. In version 8 you can do it with some limitations.
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