I believe that you would have to generate the column as GENERATED BY
DEFAULT.  That would allow you to supply values for the identity column.

Marty Killen
Sr. DB2 DBA
CNF Inc.
503-450-2681
[EMAIL PROTECTED]
IBM Certified Solutions Expert
  DB2 V7.1 Database Administration for OS/390
  DB2 V7.1 Database Administration for UNIX, Windows and
  OS/2



-----Original Message-----
From: Schwanbeck, Bernie [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 26, 2003 2:07 PM
To: [EMAIL PROTECTED]
Subject: [DB2EUG] importing identity data



Has anyone successfully imported data into a table with an identity column?

I want to override the identity values and insert values from a file.

        Here is the table layout:

                 CREATE TABLE "NSUSER  "."FACRESOURCETYPE"  (
                                  "" INTEGER NOT NULL GENERATED ALWAYS AS
IDENTITY 
                                        ( START WITH +1 , INCREMENT BY +1 ,
NO CACHE ) , 
                                  "NAME" VARCHAR(50) NOT NULL , 
                                  "ORDINAL" INTEGER )   
                                 IN "USERSPACE1" ; 

I want to override the identity values (FACRESOURCETYPE_ID) and insert
values from a file.
        Contents of the data file to be loaded:
                11,Screen,1
                22,Report,2
                33,Query,3
                44,Batch Process,4
                55,Manual Process,5
                66,Form,6
                77,Other,7

I've run the following command and numerous other import options.  The
FACRESOURCETYPE_ID ends up incrementing the values starting where it left
off and incrementing the identity by one.

        db2 import from FacilitatorResourceType.csv of del modified by
identityignore replace into nsuser.FACRESOURCETYPE

Contents of table after last import:
                db2 "select * from nsuser.FACRESOURCETYPE"

                FACRESOURCETYPE_ID NAME                     ORDINAL    
                ------------------
-------------------------------------------------- -----------
                                29 Screen
1
                                30 Report
2
                                31 Query
3
                                32 Batch Process
4
                                33 Manual Process                          5
                                34 Form
6
                                35 Other
7

                  7 record(s) selected.

Thanks in advance for your assistance.
Bernie Schwanbeck


RBC Dain Rauscher does not accept buy, sell or cancel orders by e-mail, or
any instructions by e-mail that would require your signature.  Information
contained in this communication is not considered an official record of your
account and does not supersede normal trade confirmations or statements.
Any information provided has been prepared from sources believed to be
reliable but is not guaranteed, does not represent all available data
necessary for making investment decisions and is for informational purposes
only.

This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations.  Any distribution, use or copying
of this e-mail or the information it contains by other than an intended
recipient is unauthorized.  If you receive this e-mail in error, please
advise me (by return e-mail or otherwise) immediately.

Information received by or sent from this system is subject to review by
supervisory personnel, is retained and may be produced to regulatory
authorities or others with a legal right to the information.


-
:::  When replying to the list, please use 'Reply-All' and make sure
:::  a copy goes to the list ([EMAIL PROTECTED]).
***  To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
***  For more information, check http://www.db2eug.uni.cc
-
:::  When replying to the list, please use 'Reply-All' and make sure
:::  a copy goes to the list ([EMAIL PROTECTED]).
***  To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
***  For more information, check http://www.db2eug.uni.cc

Reply via email to