用于在SQL server表中导入India的所有城市的脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用于在SQL server表中导入India的所有城市的脚本相关的知识,希望对你有一定的参考价值。

我想在SQL Server表(2008)中导入印度的所有州和城市。表格格式如下。

ID CityName StateName

我试图在谷歌上找到任何链接或脚本,但没有得到任何东西。我怎么能这样做。???

答案

试试这些城市列表的链接,http://en.wikipedia.org/wiki/List_of_cities_and_towns_in_Indiahttp://www.censusindia.gov.in/towns/town.aspx(2011年人口普查数据,不是最新的。)

另一答案
CREATE TABLE IF NOT EXISTS `state_list` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `state` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;

--
-- Dumping data for table `state_list`
--

INSERT INTO `state_list` (`id`, `state`) VALUES
(1, 'ANDAMAN AND NICOBAR ISLANDS'),
(2, 'ANDHRA PRADESH'),
(3, 'ARUNACHAL PRADESH'),
(4, 'ASSAM'),
(5, 'BIHAR'),
(6, 'CHATTISGARH'),
(7, 'CHANDIGARH'),
(8, 'DAMAN AND DIU'),
(9, 'DELHI'),
(10, 'DADRA AND NAGAR HAVELI'),
(11, 'GOA'),
(12, 'GUJARAT'),
(13, 'HIMACHAL PRADESH'),
(14, 'HARYANA'),
(15, 'JAMMU AND KASHMIR'),
(16, 'JHARKHAND'),
(17, 'KERALA'),
(18, 'KARNATAKA'),
(19, 'LAKSHADWEEP'),
(20, 'MEGHALAYA'),
(21, 'MAHARASHTRA'),
(22, 'MANIPUR'),
(23, 'MADHYA PRADESH'),
(24, 'MIZORAM'),
(25, 'NAGALAND'),
(26, 'ORISSA'),
(27, 'PUNJAB'),
(28, 'PONDICHERRY'),
(29, 'RAJASTHAN'),
(30, 'SIKKIM'),
(31, 'TAMIL NADU'),
(32, 'TRIPURA'),
(33, 'UTTARAKHAND'),
(34, 'UTTAR PRADESH'),
(35, 'WEST BENGAL'),
(36, 'TELANGANA');
另一答案

你可以从这个链接http://code.google.com/p/mysql-dumps/downloads/detail?name=cities.sql获得它

另一答案

这就是你想要的!!!!


create table all_cities (
city_name text,
city_code text,
state_code text
);

create table all_states (
state_code text,
state_name text,
country_code text
);

-- Andaman & Nicobar
INSERT INTO all_cities (city_name,city_code,state_code)
VALUES('Alipur', '101','1'),
VALUES('Andaman Island', '102','1'),
VALUES('Anderson Island', '103','1'),
VALUES('Arainj-Laka-Punga', '104','1'),
VALUES('Austinabad', '105','1'),
VALUES('Bamboo Flat', '106','1'),
VALUES('Barren Island', '107','1'),
VALUES('Beadonabad', '108','1'),
VALUES('Betapur', '109','1'),
VALUES('Bindraban', '110','1'),
VALUES('Bonington', '111','1'),
VALUES('Brookesabad', '112','1'),
VALUES('Cadell Point', '113','1'),
VALUES('Calicut', '114','1'),
VALUES('Chetamale', '115','1'),
VALUES('Cinque Islands', '116','1'),
VALUES('Defence Island', '117','1'),
VALUES('Digilpur', '118','1'),
VALUES('Dolyganj', '119','1'),
VALUES('Flat Island', '120','1'),
VALUES('Geinyale', '121','1'),
VALUES('Great Coco Island', '122','1'),
VALUES('Haddo', '123','1'),
VALUES('Havelock Island', '124','1'),
VALUES('Henry Lawrence Island', '125','1'),
VALUES('Herbertabad', '126','1'),
VALUES('Hobdaypur', '127','1'),
VALUES('Ilichar', '128','1'),
VALUES('Ingoie', '128','1'),
VALUES('Inteview Island', '130','1'),
VALUES('Jangli Ghat', '131','1'),
VALUES('Jhon Lawrence Island', '132','1'),
VALUES('Karen', '133','1'),
VALUES('Kartara', '134','1'),
VALUES('KYD Islannd', '135','1'),
VALUES('Landfall Island', '136','1'),
VALUES('Little Andmand', '137','1'),
VALUES('Little Coco Island', '138','1'),
VALUES('Long Island', '138','1'),
VALUES('Maimyo', '140','1'),
VALUES('Malappuram', '141','1'),
VALUES('Manglutan', '142','1'),
VALUES('Manpur', '143','1'),
VALUES('Mitha Khari', '144','1'),
VALUES('Neill Island', '145','1'),
VALUES('Nicobar Island', '146','1'),
VALUES('North Brother Island', '147','1'),
VALUES('North Passage Island', '148','1'),
VALUES('North Sentinel Island', '149','1'),
VALUES('Nothen Reef Island', '150','1'),
VALUES('Outram Island', '151','1'),
VALUES('Pahlagaon', '152','1'),
VALUES('Palalankwe', '153','1'),
VALUES('Passage Island', '154','1'),
VALUES('Phaiapong', '155','1'),
VALUES('Phoenix Island', '156','1'),
VALUES('Port Blair', '157','1'),
VALUES('Preparis Island', '158','1'),
VALUES('Protheroepur', '159','1'),
VALUES('Rangachang', '160','1'),
VALUES('Rongat', '161','1'),
VALUES('Rutland Island', '162','1'),
VALUES('Sabari', '163','1'),
VALUES('Saddle Peak', '164','1'),
VALUES('Shadipur', '165','1'),
VALUES('Smith Island', '166','1'),
VALUES('Sound Island', '167','1'),
VALUES('South Sentinel Island', '168','1'),
VALUES('Spike Island', '169','1'),
VALUES('Tarmugli Island', '170','1'),
VALUES('Taylerabad', '171','1'),
VALUES('Titaije', '172','1'),
VALUES('Toibalawe', '173','1'),
VALUES('Tusonabad', '174','1'),
VALUES('West Island', '175','1'),
VALUES('Wimberleyganj', '176','1'),
VALUES('Yadita', '177','1');


-- Andhra Pradesh
INSERT INTO all_cities (city_name,city_code,state_code)
VALUES('Adilabad', '201','2'),
VALUES('Anantapur', '201','2'),
VALUES('Chittoor', '203','2'),
VALUES('Cuddapah', '204','2'),
VALUES('East Godavari', '205','2'),
VALUES('Guntur', '206','2'),
VALUES('Hyderabad', '207','2'),
VALUES('Karimnagar', '208','2'),
VALUES('Khammam', '209','2'),
VALUES('Krishna', '210','2'),
VALUES('Kurnool', '211','2'),
VALUES('Mahabubnagar', '212','2'),
VALUES('Medak', '213','2'),
VALUES('Nalgonda', '214','2'),
VALUES('Nellore', '215','2'),
VALUES('Nizamabad', '216','2'),
VALUES('Prakasam', '217','2'),
VALUES('Rangareddy', '218','2'),
VALUES('Srikakulam', '219','2'),
VALUES('Visakhapatnam', '220','2'),
VALUES('Vizianagaram', '221','2'),
VALUES('Warangal', '222','2'),
VALUES('West Godavari', '223','2');



-- Arunachal Pradesh
INSERT INTO all_cities (city_name,city_code,state_code)
VALUES('Anjaw', '301','3'),
VALUES('Changlang', '302','3'),
VALUES('Dibang Valley', '303','3'),
VALUES('East Kameng', '304','3'),
VALUES('East Siang', '305','3'),
VALUES('Itanagar', '306','3'),
VALUES('Kurung Kumey', '307','3'),
VALUES('Lohit', '308','3'),
VALUES('Lower Dibang Valley', '309','3'),
VALUES('Lower Subansiri', '310','3'),
VALUES('Papum Pare', '311','3'),
VALUES('Tawang', '312','3'),
VALUES('Tirap', '313','3'),
VALUES('Upper Siang', '314','3'),
VALUES('Upper Subansiri', '315','3'),
VALUES('West Kameng', '316','3'),
VALUES('West Siang', '317','3');

-- Assam
INSERT INTO all_cities (city_name,city_code,state_code)
VALUES('Barpeta', '401','4'),
VALUES('Bongaigaon', '402','4'),
VALUES('Cachar', '403','4'),
VALUES('Darrang', '404','4'),
VALUES('Dhemaji', '405','4'),
VALUES('Dhubri', '406','4'),
VALUES('Dibrugarh', '407','4'),
VALUES('Goalpara', '408','4'),
VALUES('Golaghat', '409','4'),
VALUES('Guwahati', '410','4'),
VALUES('Hailakandi', '411','4'),
VALUES('Jorhat', '412','4'),
VALUES('Kamrup', '413','4'),
VALUES('Karbi Anglong', '414','4'),
VALUES('Karimganj', '415','4'),
VALUES('Kokrajhar', '416','4'),
VALUES('Lakhimpur', '417','4'),
VALUES('Marigaon', '418','4'),
VALUES('Nagaon', '419','4'),
VALUES('Nalbari', '420','4'),
VALUES('North Cachar Hills', '421','4'),
VALUES('Silchar', '422','4'),
VALUES('Sivasagar', '423','4'),
VALUES('Sonitpur', '424','4'),
VALUES('Tinsukia', '425','4'),
VALUES('Udalguri', '426','4');


-- Bihar
INSERT INTO all_cities (city_name,city_code,state_code)
VALUES('Araria', '501','5'),
VALUES('Aurangabad', '502','5'),
VALUES('Banka', '503','5'),
VALUES('Begusarai', '504','5'),
VALUES('Bhagalpur', '505','5'),
VALUES('Bhojpur', '506','5'),
VALUES('Buxar', '507','5'),
VALUES('Darbhanga', '508','5'),
VALUES('East Champaran', '509','5'),
VALUES('Gaya', '510','5'),
VALUES('Gopalganj', '511','5'),
VALUES('Jamshedpur', '512','5'),
VALUES('Jamui', '513','5'),
VALUES('Jehanabad', '514','5'),
VALUES('Kaimur (Bhabua)', '515','5'),
VALUES('Katihar', '516','5'),
VALUES('Khagaria', '517','5'),
VALUES('Kishanganj', '518','5'),
VALUES('Lakhisarai', '519','5'),
VALUES('Madhepura', '520','5'),
VALUES('Madhubani', '521','5'),
VALUES('Munger', '522','5'),
VALUES('Muzaffarpur', '523','5'),
VALUES('Nalanda', '524','5'),
VALUES('Nawada', '525','5'),
VALUES('Patna', '526','5'),
VALUES('Purnia', '527','5'),
VALUES('Rohtas', '528','5'),
VALUES('Saharsa', '529','5'),
VALUES('Samastipur'

以上是关于用于在SQL server表中导入India的所有城市的脚本的主要内容,如果未能解决你的问题,请参考以下文章

在 SQL Server 2017 中导入 xml 数据

在 sql server 2000 中导入 Excel 电子表格

在 SQL Server 中导入和解析大型 XML 文件(当“正常”方法相当慢时)

xml 使用数据导入处理程序在Solr中导入/索引数据库(MySQL或SQL Server)

从多个表和查询中导入事实表数据

在SharePoint 2010列表中导入SQL表数据的最佳方法是什么?