Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing double quotes before importing to mysql

Status
Not open for further replies.

yahoo182

Programmer
Jul 5, 2005
70
CA
Hi there,
I have a text file of the following format
Code:
1211|d|"http:[URL unfurl="true"]www.abc.com"[/URL]
1211|d|"http:[URL unfurl="true"]www.abc.com"[/URL]
1211|d|"http:[URL unfurl="true"]www.abc.com"[/URL]
1211|d|"http:[URL unfurl="true"]www.abc.com"[/URL]

Is there a way in Mysql to remove the quotes in the 3rd fiend before importing it?

So far, im using the code
Code:
mysql > load data local infile '/home/kkohakur/Hotel_All_Active07-05-05.csv'
    -> into table hotelinfo
    -> fields terminated by ','
    -> lines terminated by '\n'
but it is importing the " as well.

Thanks
 
As suggested in the other thread, use:[tt]
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'[/tt]
 
Hi there
here is what I have so far.
But when I try to compile it (with csc.exe from command line) it says I can't find the Mysql namespace.

I have copied the mysql_data.dll in my
C:\WINDOWS\Microsoft.net\framwork\v1.1.4322 folder.

Code:
using MySql.Data.MySqlClient;

public class mysqlConnect {
    public void main (String[] args)
    {
           InsertRow();
    }
    public void InsertRow(string myConnectionString) 
    {
        // If the connection string is null, use a default.
        if(myConnectionString == "") 
        {
            myConnectionString = "Database=hotelInfo;Data Source=localhost;User Id=test;Password=tester";
        }
        MySqlConnection myConnection = new MySqlConnection(myConnectionString);
        string myInsertQuery = "INSERT INTO images (Name, Caption, URL) Values('difs','dfjdi', '30.66')";
        MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
        myCommand.Connection = myConnection;
        myConnection.Open();
        myCommand.ExecuteNonQuery();
        myCommand.Connection.Close();
    }

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top