If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Ingres copy table from csv file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-17-07, 10:46
ashley2780 ashley2780 is offline
Registered User
 
Join Date: May 2007
Posts: 2
Question 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 11:01.
Reply With Quote
  #2 (permalink)  
Old 05-17-07, 12:25
ashley2780 ashley2780 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On