Page 1 of 1

how to import data from a text file?

Posted: Thu Jan 15, 2009 1:55 am
by Tassadduq
i have two text file which contains countries and city names.
the structure of the files are as
country names =
total fields in the country names text files are 4.
1=cc_fips
2=cc_iso
3=tld
4=country_name
second text file contains the cities name of all the world.
total fields in the cities names are 2
1=cc_fips
2=city_name

i have created a database named "cityofcountries".
in the database i have two tables
1=countries
2=cities

the fields of the countries tables are
1=countryid
2=countryname
3=country_tld
4=country_cc_iso
5=country_cc_fips
and the fileds of the cities table are
1=cityid
2=cityname
3=city_cc_fips

now i want to import the countries data from countries name text file into countries table and cities name data from cities name text file into cities table.

so what will be the query?

Re: how to import data from a text file?

Posted: Thu Jan 15, 2009 2:09 am
by VladSun
I don't know - you didn't mention the SQL engine you are using. MySQL, PGSQL, MSSQL ... etc.?

Re: how to import data from a text file?

Posted: Thu Jan 15, 2009 3:44 am
by Tassadduq
i am using SQLyog Enterprise