Skip to main content

Hardcoding values into Copy statement


Navin_C
Forum|alt.badge.img+2
Hello, I have a scenario where in I need to load table from flat file using COPY command The file has just one column the table has 5 columns first column needs to be loaded form the flat file and 3 column need to be hardoced( with some values) and last column is a sysdate(). Can anybody help me to achieve this. I wonder how copy statement can hardcode the value for specific columns.

2 replies

Forum|alt.badge.img+2
  • Participating Frequently
  • June 25, 2013
Hi Navin, You can do it like this copy test(c1, c2 as '2', c3 as '3', c4 as '4', c5 as '5') from 'FILE"; Where c1 that has nothing as will be the one that load the data from the file. Hope this helps, Eugenia

Navin_C
Forum|alt.badge.img+2
  • Author
  • Participating Frequently
  • June 25, 2013
Thanks for that Eugenia, That did the trick.