View Single Post
Old 2012-05-22   #1 (permalink)
ais_test
Junior Member
 
Join Date: May 2012
Posts: 2
Default Insert with COPY TABLE, add columns

Hi everybody.

My company is making few tests in order to use vectorwise for some projects, but we have the need to make some special inserts that im not able to reproduce in vector wise, this is the examle...
Table:
Code:
CREATE TABLE MYTABLE (
      CLIENTNUM           VARCHAR(20) NULL,
      DATADATE            DATE NULL,
      TYPECLIENT         VARCHAR(2) NULL,
      TITTLENUMBER             INTEGER NULL,
      TOTAL         DECIMAL(14,2) NULL,
      PHISICALID  INTEGER NOT NULL,
      CONSTID     INTEGER NOT NULL,
      DATAID      INTEGER NOT NULL,
      RUNDATE              date,
      CONSTRAINT XPKMYTABLE
            PRIMARY KEY (DATAID, CONSTID, PHISICALID  )
);\p\g
And the next would be the insert from a positional file:
Code:
COPY TABLE MYTABLE (
      CLIENTNUM = CHAR(20)
      DATADATE   = CHAR(10)
      TYPECLIENT    =CHAR(2)
      TITTLENUMBER   =CHAR(2)
      TOTAL       = CHAR(16)

      PHISICALID  = Sequence(1,1)
      CONSTID     = 1
      DATAID      = 1
      RUNDATE         = getDate()
  
);\p\g
And the last 4 columns are not in the file, should be added on runtime.
PHISICALID as some kind of sequence
CONSTID and DATA ID as a fixed constant num by now... who cares just a "1"
RNDATE should be the day of running that insert.

This would be data to insert as a example:
Code:
000000007           2009-01-315300+000000021425,66
How can i make that insert work?

Thnk you in advance

Leo

PS: As further work, our file have the date as yyyyMMdd (Fixed the "yyy" typo), without any separators, if we can make that work would make me and my boss rly happy and we would end by buying the product.

Tyvm

Last edited by ais_test; 2012-05-22 at 04:18 AM.
ais_test is offline   Reply With Quote