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 > Loading a table with GENERATED BY DEFAULT AS IDENTITY

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-10-08, 10:17
samu78nyc samu78nyc is offline
Registered User
 
Join Date: Nov 2006
Posts: 31
Loading a table with GENERATED BY DEFAULT AS IDENTITY

Hi all,

I am trying to load the data from EMPLOYEE table into EMPLOYEE_NEW table.Both the tables have the below structure.

EMPLOYEE (
EMPNO BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY ( START WITH +1 INCREMENT BY +1 MINVALUE +1 MAXVALUE +9223372036854775807 NO CYCLE CACHE 20 NO ORDER ),
LAST NAME NOT NULL,
FIRST NAME NOT NULL)

load cursor statements.

DECLARE CURSOR1 CURSOR FOR SELECT * FROM EMPLOYEE;
LOAD FROM CURSOR1 OF CURSOR MODIFIED BY IDENTITYOVERRIDE INSERT INTO EMPLOYEE_NEW;

error :
SQL3526N The modifier clause "IDENTITYOVERRIDE" is inconsistent with the
current load command. Reason code: "5".
Reason :
The IDENTITYOVERRIDE file type modifier cannot be used when loading a table with a GENERATED BY DEFAULT identity column.

What is the best solution to load the data into EMPLOYEE_NEW table and to retain the EMPNO from the EMPLOYEE table.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 12-10-08, 10:25
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
If you read the documentation then you would know that IDENTITYOVERRIDE is for GENERATED ALWAYS, not GENERATED BY DEFAULT. If you just remove that clause from the load, it should work the way you want it to.

Andy
Reply With Quote
  #3 (permalink)  
Old 12-10-08, 10:43
samu78nyc samu78nyc is offline
Registered User
 
Join Date: Nov 2006
Posts: 31
Thanks

Works great..Thanks
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