之前我做了一个一键生成全国省和城市数据库表的SQL语句,但是没有县的,现在这个SQL语句可以生成包括省直辖市、城市,以及县城市数据库表,如果不全欢迎留言补充!
由于代码太多只列出一部分,请下载附件。
----------创建省、直辖市、自治区数据库表---------------------------------------
CREATE TABLE [dbo].[PROVINCES] (
[CODE] [char] (6) NOT NULL PRIMARY KEY ,
[PROVINCESNAME] [varchar] (50)
)
----------插入省、直辖市、自治区数据---------------------------------------
INSERT INTO PROVINCES VALUES(110000,'北京市')
INSERT INTO PROVINCES VALUES(120000,'天津市')
INSERT INTO PROVINCES VALUES(130000,'河北省')
INSERT INTO PROVINCES VALUES(140000,'山西省')
INSERT INTO PROVINCES VALUES(150000,'内蒙古自治区')
INSERT INTO PROVINCES VALUES(210000,'辽宁省')
INSERT INTO PROVINCES VALUES(220000,'吉林省')
INSERT INTO PROVINCES VALUES(230000,'黑龙江省')
INSERT INTO PROVINCES VALUES(310000,'上海市')
INSERT INTO PROVINCES VALUES(320000,'江苏省')
INSERT INTO PROVINCES VALUES(330000,'浙江省')
INSERT INTO PROVINCES VALUES(340000,'安徽省')
INSERT INTO PROVINCES VALUES(350000,'福建省')
INSERT INTO PROVINCES VALUES(360000,'江西省')
INSERT INTO PROVINCES VALUES(370000,'山东省')
INSERT INTO PROVINCES VALUES(410000,'河南省')
INSERT INTO PROVINCES VALUES(420000,'湖北省')
INSERT INTO PROVINCES VALUES(430000,'湖南省')
INSERT INTO PROVINCES VALUES(440000,'广东省')
INSERT INTO PROVINCES VALUES(450000,'广西壮族自治区')
INSERT INTO PROVINCES VALUES(460000,'海南省')
INSERT INTO PROVINCES VALUES(500000,'重庆市')
INSERT INTO PROVINCES VALUES(510000,'四川省')
INSERT INTO PROVINCES VALUES(520000,'贵州省')
INSERT INTO PROVINCES VALUES(530000,'云南省')
INSERT INTO PROVINCES VALUES(540000,'西藏自治区')
INSERT INTO PROVINCES VALUES(610000,'陕西省')
INSERT INTO PROVINCES VALUES(620000,'甘肃省')
INSERT INTO PROVINCES VALUES(630000,'青海省')
INSERT INTO PROVINCES VALUES(640000,'宁夏回族自治区')
INSERT INTO PROVINCES VALUES(650000,'新疆维吾尔自治区')