-1

I am trying to remove the double quotes for the numeric columns using export command by using replace function but it wont worked out, below is the query I used in Linux environment,

EXPORT TO '/Staging/ebi/src/CLP/legal_bill_charge_adjustment11.csv' OF DEL 
MESSAGES '/Staging/ebi/src/CLP/legal_bill_charge_adjustment11.log' 
select
CLIENT_ID,
CLIENT_DIVISION_ID,
CLIENT_OFFICE_ID,
MATTER_ID,
LEGAL_BILL_CHARGE_ADJ_ID,
LEGAL_BILL_CHARGE_ID,
ADJUSTMENT_DT,
replace ( ORIGINAL_ADJUSTMENT_AMT,""),
replace (CURRENT_ADJUSTMENT_AMT,""),
replace (SYSTEM_ADJUSTMENT_AMT,""),
replace (CLIENT_ADJUSTMENT_AMT,""),
replace (DELETED_ADJUSTMENT,""),
FLAGGED_AMOUNT,
ADJUSTMENT_USER,
STATUS_DESC,
ADJUSTMENT_COMMENT,
WF_TASK_NAME,
WF_TASK_DESC from CLP.legal_bill_charge_adjustment1;

If anyone suggest me the exact db2 query it would be helpful. Thanks in advance.

mustaccio
  • 18,234
  • 16
  • 48
  • 57
user9419188
  • 27
  • 4
  • 14

1 Answers1

0

Export will not have quotes around numeric data types. You have not provided any data type information so I suppose your numeric content may be stored in a CHAR/VARCHAR column. Try casting the columns to numeric data types in the export SQL statement.

i.e.

SELECT cast(Textcol as integer) as colname

..

MichaelTiefenbacher
  • 3,805
  • 2
  • 11
  • 17
  • Thanks..But i dont want to change column datatype, i have five columns as name,age,address,salary,department name -->varchar(20) age->integer address->varchar(200) salary-->decimal(23,6) department-->varchar(50) – user9419188 Jun 21 '18 at 10:54
  • I am havig data to load the table in a csv file below, "alvin","45","xyz street petaluma, north america","200000.00","xyz" db2 is taking numeric value enclosed with the double as string I want the data to be look like "alvin",45,"xyz street petaluma north america",200000.00,"xyz" Is there any command to load the data without double quotes for numric columns into the table. please suggest any solution for the above issue would be very helpfull for me. – user9419188 Jun 21 '18 at 10:55
  • This is confusing - in your original question you alk aout exporting (in Db2 exporting means moving data from the database to a file) and now your comment is that you have got a file and that you want to load it into the database... – MichaelTiefenbacher Jun 22 '18 at 15:37
  • Yes..Actually my issue is to load the CSV file into a table without double quotes for only numeric columns..To remove the double quotes for numeric columns I have created the same dummy table and make numeric columns as varchar and I have loaded the data.. – user9419188 Jun 25 '18 at 13:40
  • then I tried to export the data from the table by replacing double quotes. – user9419188 Jun 25 '18 at 13:41