Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    3

    Unanswered: Removing the quotes(" ") around the column

    Hi,

    I am trying to export the data into a text file using the following script.

    db2 "export to /home/tigher/USER.txt of del select ROW_ID, CREATED,PAR_ROW_ID, LOGIN, USER_FLG FROM SIEBEL.S_USER "

    the sample output is as follows:
    "1-04AF","2001-01-08-19.09.42.000000","1-04AF","WAWRA","Y"

    But here, I don't want the quotes(") around the date value(Created column) and I want to keep the quotes around for the remaining columns. could you someone help me how do I achieve this?

    Thanks for your help!
    Manu

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: Removing the quotes(" ") around the column

    Originally posted by kapaluru


    db2 "export to /home/tigher/USER.txt of del select ROW_ID, CREATED,PAR_ROW_ID, LOGIN, USER_FLG FROM SIEBEL.S_USER "

    the sample output is as follows:
    "1-04AF","2001-01-08-19.09.42.000000","1-04AF","WAWRA","Y"

    But here, I don't want the quotes(") around the date value(Created column) and I want to keep the quotes around for the remaining columns. could you someone help me how do I achieve this?
    You could concatenate all columns into a single string while formatting it the way you need:

    PHP Code:
    export ... select rtrim(row_id) || '",' || rtrim(char(created))  || ',"' || rtrim (par_row_id) || '","' ... 

  3. #3
    Join Date
    Mar 2004
    Posts
    3
    Thanks for the reply n_i,

    I have modified the script based on your suggestion...but getting the Syntax error.Here is the script that I am using and the error message:

    db2 "export to /home/tiger/USER.txt of del select rtrim(row_id) || '",' || rtrim(char(created)) || ',"' || rtrim (par_row_id) || '",'" || rtrim(login) || '","' || rtrim (user_flg) || FROM SIEBEL.S_USER "

    0403-057 Syntax error at line 5 : `'' is not matched

    Could you please confirm whether the modification are correct?

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Originally posted by kapaluru
    Thanks for the reply n_i,

    I have modified the script based on your suggestion...but getting the Syntax error.Here is the script that I am using and the error message:

    db2 "export to /home/tiger/USER.txt of del select rtrim(row_id) || '",' || rtrim(char(created)) || ',"' || rtrim (par_row_id) || '",'" || rtrim(login) || '","' || rtrim (user_flg) || FROM SIEBEL.S_USER "

    0403-057 Syntax error at line 5 : `'' is not matched

    Could you please confirm whether the modification are correct?
    Well, since you run the statement from the OS prompt, whatever it is, you'll have to escape the double quotes within the statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •