Manoj Maharana

Manoj Maharana

  • NA
  • 362
  • 128.5k

excel import all cities and state in SQL server table

Aug 31 2016 2:56 AM

I have 2 tables City_Locality and Country_State:

In Country_State table consisting of ID,Name,ParentID,HasState,Currency,IsActive,IsTopCountry.

In City_Locality table consisting of

ID,StateID,CountryID,Name,ParentID,DisplayOrder.IsActive,IsRequest,IsTopCity.

I have a excel sheet(city.xlsx) having city_name,city_state.

I want to import data from excel sheet to database by using sql 2008. I have already state data is in the Country_State table. I have already some city data is in the City_Locality table.

I want a sql query to check duplicacy while insert the data in City_Locality table and what is the sql query to insert excel data into database??


Answers (5)