DB2 – Converting Regular Table to Partitioned Using Online Table Move

db2db2-10.5db2-luw

I am converting my regular table to partitioned table using timestamp column. However, the below code fails with sql error 2103 reason code 6.
Please note that there are no referential(or foreign key constraints) on this table so wondering where I am going wrong. There is primary key and few indexes defined on TRANSACTION table. Kindly help !

I am not using any options as well for simplicity though I want to use ' KEEP, COPY_USE_LOAD,COPY_WITH_INDEXES' as option.

  CALL SYSPROC.ADMIN_MOVE_TABLE(
  'ADMIN',
  'TRANSACTION',
  '',
  '',
  '',
  '',
  '',  
  '(TRANSACTIONDATE) (STARTING FROM (1/1/2010) ENDING AT (1/1/2017) EVERY 1 MONTH)',
  '',
  '',
  'MOVE'
  )

Best Answer

The only problem seems to be your missing quotes for the dates. As they are enclosed in the string the have to be escaped (with a second single quote) like in my example:

CALL SYSPROC.ADMIN_MOVE_TABLE(
    'ADMIN',
    'TRANSACTION', 
    '', '', '', '', '',  
    '(TRANSACTIONDATE) (STARTING FROM (''1/1/2010'') ENDING AT (''1/1/2017'') EVERY 1 MONTH)', 
    '', '', 'MOVE' )