Results 1 to 2 of 2
  1. #1
    Join Date
    May 2007
    Posts
    2

    Question Unanswered: Ingres copy table from csv file

    Hi All,
    I am using the "Copy table" utility to load values from a comma seperated file (csv). I am able to copy the data to a new table however, the fields themself are with single quotes. Hence, the copy includes the single quotes in my table as well. Is there a way for eliminating the single quotes surrounding the csv?

    The csv file format is:
    '1111','id1',0
    '3333','id2',1

    Here is the copy table syntax I am using:
    copy table test_tbl (uuid=char(0)comma, vid=char(0)comma, isvalid=char(0)nl) from 'C:\TEMP\test_tbl.csv'

    I want to copy only the values -> 1111, id1,0 in row 1 and 3333, id2, 1 in row 2.
    The csv has a large number of rows - about 800 KB.

    Is it possible to indicate "strings embedded" in "copy from" as we can in Import Assistant?

    Can anyone help?

    Thanks,
    _ash_
    Last edited by ashley2780; 05-17-07 at 12:01.

  2. #2
    Join Date
    May 2007
    Posts
    2

    Thumbs up Solution :)

    I managed to work out the solution:
    copy table test_tbl (uuid=char(0)comma, vid=char(0)comma, isvalid=char(0)nl) from 'C:\TEMP\test_tbl.csv'
    '1111','id1',0

    copy table test_tbl (
    x=d1, /* remove 1st quote 'd0''' or d1 */
    uuid='c0''', /* get data upto first quote */
    x1=d2, /* remove quote and comma before vid x1='d1' or d1 :: use d1 to remove 1 char etc */
    vid='c0''',
    x4=d1,
    isvalid=c0nl
    ) from 'C:\TEMP\test_tbl.csv'

    Hope this help someone like me

Posting Permissions

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