省
DROP table [province]
CREATE table [province] ( [ID] [int] NOT NulL,[provinceID] [char] (6) NulL,[province] [nvarchar] (40) NulL )
INSERT [province] ( [ID],[provinceID],[province] ) VALUES ( 1,'110000','北京市' )
INSERT [province] ( [ID],[province] ) VALUES ( 2,'120000','天津市' )
INSERT [province] ( [ID],[province] ) VALUES ( 3,'130000','河北省' )
市
DROP table [city]
CREATE table [city] ( [ID] [int] NOT NulL,[cityID] [char] (6) NulL,[city] [nvarchar] (50) NulL,[father] [char] (6) NulL )
INSERT [city] ( [ID],[cityID],[city],[father] ) VALUES ( 1,'110100','市辖区','110000' )
INSERT [city] ( [ID],[father] ) VALUES ( 2,'110200','县',[father] ) VALUES ( 3,'120100','120000' )
INSERT [city] ( [ID],[father] ) VALUES ( 4,'120200',[father] ) VALUES ( 5,'130100','石家庄市','130000' )
INSERT [city] ( [ID],[father] ) VALUES ( 6,'130200','唐山市',[father] ) VALUES ( 7,'130300','秦皇岛市',[father] ) VALUES ( 8,'130400','邯郸市',[father] ) VALUES ( 9,'130500','邢台市',[father] ) VALUES ( 10,'130600','保定市',[father] ) VALUES ( 11,'130700','张家口市',[father] ) VALUES ( 12,'130800','承德市',[father] ) VALUES ( 13,'130900','沧州市',[father] ) VALUES ( 14,'131000','廊坊市',[father] ) VALUES ( 15,'131100','衡水市','130000' )
县
DROP table [area]
CREATE table [area] ( [ID] [int] NOT NulL,[areaID] [char] (6) NulL,[area] [nvarchar] (60) NulL,[father] [char] (6) NulL )
INSERT [area] ( [ID],[areaID],[area],'110101','东城区','110100' )
INSERT [area] ( [ID],'110102','西城区','110100' )
INSERT [area] ( [ID],[father] ) VALUES ( 21,'120103','河西区','120100' )
INSERT [area] ( [ID],[father] ) VALUES ( 22,'120104','南开区',[father] ) VALUES ( 23,'120105','河北区',[father] ) VALUES ( 24,'120106','红桥区',[father] ) VALUES ( 25,'120107','塘沽区',[father] ) VALUES ( 26,'120108','汉沽区',[father] ) VALUES ( 27,'120109','大港区',[father] ) VALUES ( 28,'120110','东丽区',[father] ) VALUES ( 29,'120111','西青区',[father] ) VALUES ( 30,'120112','津南区',[father] ) VALUES ( 31,'120113','北辰区',[father] ) VALUES ( 32,'120114','武清区','120100' )
INSERT [area] ( [ID],[father] ) VALUES ( 38,'130102','长安区','130100' )
INSERT [area] ( [ID],[father] ) VALUES ( 39,'130103','桥东区',[father] ) VALUES ( 40,'130104','桥西区',[father] ) VALUES ( 41,'130105','新华区',[father] ) VALUES ( 42,'130107','井陉矿区',[father] ) VALUES ( 43,'130108','裕华区',[father] ) VALUES ( 44,'130121','井陉县',[father] ) VALUES ( 45,'130123','正定县',[father] ) VALUES ( 46,'130124','栾城县',[father] ) VALUES ( 47,'130125','行唐县',[father] ) VALUES ( 48,'130126','灵寿县','130100' )
以上是内存溢出为你收集整理的SQLserver创建省市县三级联动的建表代码全部内容,希望文章能够帮你解决SQLserver创建省市县三级联动的建表代码所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)