省市区县四级联动数据
最近在做一套系统,需要用到省市级联,网上翻了翻,看似蛮多的,但实际能用的却挺少。
于是就有了此文。
下面的数据来自于DiscuzX,我提取了
install_data.sql、common_district_1.sql、common_district_2.sql、common_district_3.sql
这三个SQL文件里的内容。制作了一个表。
/* 地区信息(M_DISTRICT) Created 2012/06/15 [CN]harde */ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[M_DISTRICT]') AND type in (N'U')) DROP TABLE [dbo].[M_DISTRICT] GO CREATE TABLE M_DISTRICT ( [COUNTRY_NO] decimal(18,0) NOT NULL, [DISTRICT_NO] decimal(18,0) NOT NULL, [NAME] nvarchar(20) NOT NULL, [LEVEL] decimal(18,0) NOT NULL, [PARENT_NO] decimal(18,0), [SEQ] decimal(18,0) DEFAULT 0, [REMARKS] ntext, [DEL_FLG] decimal(1) DEFAULT 0 NOT NULL, [MK_DATE] datetime DEFAULT 'getdate()' NOT NULL, [MK_USER] decimal(18,0), [UP_DATE] datetime DEFAULT 'getdate()' NOT NULL, [UP_USER] decimal(18,0), CONSTRAINT PK_M_DISTRICT PRIMARY KEY(COUNTRY_NO, DISTRICT_NO) ) GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地区信息' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'国家编号' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'COUNTRY_NO' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地区编号' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'DISTRICT_NO' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'名称' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'NAME' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'深度' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'LEVEL' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'父级编号' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'PARENT_NO' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'SEQ' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'REMARKS' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'删除标记' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'DEL_FLG' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建日期' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'MK_DATE' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建者' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'MK_USER' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新日期' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'UP_DATE' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新者' , @level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'M_DISTRICT',@level2type=N'COLUMN',@level2name=N'UP_USER' GO
数据文件未压缩为48Mb,大约4万5千条数据左右。
简单展示几条数据:
select * from M_DISTRICT where level = 1; /*结果*/ 0 1 北京市 1 NULL 1 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 2 天津市 1 NULL 2 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 3 河北省 1 NULL 3 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 4 山西省 1 NULL 4 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL ......省略 select * from M_DISTRICT where parent_no = 1; /*结果*/ 0 37 东城区 2 1 37 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 38 西城区 2 1 38 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 39 崇文区 2 1 39 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 40 宣武区 2 1 40 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 41 朝阳区 2 1 41 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL ......省略 select * from M_DISTRICT where parent_no = 37; 0 567 东华门街道 3 37 567 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 568 东四街道 3 37 568 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 569 东直门街道 3 37 569 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 570 交道口街道 3 37 570 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 571 北新桥街道 3 37 571 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL ......省略 select * from M_DISTRICT where parent_no = 53; 0 848 不老屯镇 3 53 848 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 849 东邵渠镇 3 53 849 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 850 冯家峪镇 3 53 850 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 851 北庄镇 3 53 851 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 852 十里堡镇 3 53 852 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 853 古北口镇 3 53 853 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL 0 854 大城子镇 3 53 854 NULL 0 2012-06-15 13:48:53.000 NULL 2012-06-15 13:48:53.000 NULL ......省略
下载地址:省市区县四级联动数据库
百度网盘:http://pan.baidu.com/netdisk/singlepublic?fid=386202_3625532865
115网盘:http://115.com/file/beom1ipt#M-DISTRICT[DATA].zip
华为网盘:http://dl.dbank.com/c09825ildy