今天写代码的时候需要用到全国城市区号,网上找了好久没有现成的SQL,于是自己录数据写了一个,和大家共享!

目前还只有300个城市的区号

文件下载地址放在最后!

GO
IF EXISTS (SELECT 1 FROM sysobjects WHERE id=OBJECT_ID('y_City') AND xtype='u')
BEGIN
DROP TABLE dbo.y_City
END
GO CREATE TABLE dbo.y_City(
CityID INT PRIMARY KEY IDENTITY(1,1),
Company VARCHAR(100),
CityName VARCHAR(100),
CityCode VARCHAR(100)
)
GO
DELETE FROM dbo.y_City INSERT INTO dbo.y_City(Company,CityName,CityCode)
SELECT '','北京','' UNION ALL
SELECT '','鄂州','' UNION ALL
SELECT '','恩施','' UNION ALL
SELECT '','黄冈','' UNION ALL
SELECT '','黄石','' UNION ALL
SELECT '','荆门','' UNION ALL
SELECT '','荆州','' UNION ALL
SELECT '','十堰','' UNION ALL
SELECT '','随州','' UNION ALL
SELECT '','武汉','' UNION ALL
SELECT '','咸宁','' UNION ALL
SELECT '','襄樊','' UNION ALL
SELECT '','孝感','' UNION ALL
SELECT '','宜昌','' UNION ALL
SELECT '','潮州','' UNION ALL
SELECT '','东莞','' UNION ALL
SELECT '','佛山','' UNION ALL
SELECT '','广州','' UNION ALL
SELECT '','河源','' UNION ALL
SELECT '','惠州','' UNION ALL
SELECT '','江门','' UNION ALL
SELECT '','揭阳','' UNION ALL
SELECT '','茂名','' UNION ALL
SELECT '','梅州','' UNION ALL
SELECT '','清远','' UNION ALL
SELECT '','汕头','' UNION ALL
SELECT '','汕尾','' UNION ALL
SELECT '','韶关','' UNION ALL
SELECT '','阳江','' UNION ALL
SELECT '','云浮','' UNION ALL
SELECT '','湛江','' UNION ALL
SELECT '','肇庆','' UNION ALL
SELECT '','中山','' UNION ALL
SELECT '','珠海','' UNION ALL
SELECT '','上海','' UNION ALL
SELECT '','巴中 ','' UNION ALL
SELECT '','成都','' UNION ALL
SELECT '','成都郊县','' UNION ALL
SELECT '','达州','' UNION ALL
SELECT '','德阳','' UNION ALL
SELECT '','甘孜','' UNION ALL
SELECT '','广安','' UNION ALL
SELECT '','广元','' UNION ALL
SELECT '','乐山','' UNION ALL
SELECT '','凉山','' UNION ALL
SELECT '','泸州','' UNION ALL
SELECT '','眉山','' UNION ALL
SELECT '','绵阳','' UNION ALL
SELECT '','内江','' UNION ALL
SELECT '','南充','' UNION ALL
SELECT '','攀枝花','' UNION ALL
SELECT '','遂宁','' UNION ALL
SELECT '','雅安','' UNION ALL
SELECT '','宜宾','' UNION ALL
SELECT '','资阳','' UNION ALL
SELECT '','自贡','' UNION ALL
SELECT '','鞍山','' UNION ALL
SELECT '','本溪','' UNION ALL
SELECT '','朝阳','' UNION ALL
SELECT '','丹东','' UNION ALL
SELECT '','抚顺','' UNION ALL
SELECT '','阜新','' UNION ALL
SELECT '','葫芦岛','' UNION ALL
SELECT '','锦州','' UNION ALL
SELECT '','辽阳','' UNION ALL
SELECT '','盘锦','' UNION ALL
SELECT '','沈阳','' UNION ALL
SELECT '','铁岭','' UNION ALL
SELECT '','营口','' UNION ALL
SELECT '','安康','' UNION ALL
SELECT '','宝鸡','' UNION ALL
SELECT '','汉中','' UNION ALL
SELECT '','商洛','' UNION ALL
SELECT '','铜川','' UNION ALL
SELECT '','渭南','' UNION ALL
SELECT '','西安','' UNION ALL
SELECT '','咸阳','' UNION ALL
SELECT '','延安','' UNION ALL
SELECT '','榆林','' UNION ALL
SELECT '','海南','' UNION ALL
SELECT 'A','常州','' UNION ALL
SELECT 'A','淮安','' UNION ALL
SELECT 'A','连云港','' UNION ALL
SELECT 'A','南京','' UNION ALL
SELECT 'A','南通','' UNION ALL
SELECT 'A','苏州','' UNION ALL
SELECT 'A','宿迁','' UNION ALL
SELECT 'A','泰州','' UNION ALL
SELECT 'A','无锡','' UNION ALL
SELECT 'A','徐州','' UNION ALL
SELECT 'A','盐城','' UNION ALL
SELECT 'A','扬州','' UNION ALL
SELECT 'A','镇江','' UNION ALL
SELECT 'B','杭州','' UNION ALL
SELECT 'B','湖州','' UNION ALL
SELECT 'B','嘉兴','' UNION ALL
SELECT 'B','金华','' UNION ALL
SELECT 'B','丽水','' UNION ALL
SELECT 'B','衢州','' UNION ALL
SELECT 'B','绍兴','' UNION ALL
SELECT 'B','台州','' UNION ALL
SELECT 'B','温州','' UNION ALL
SELECT 'B','舟山','' UNION ALL
SELECT 'C','滨州','' UNION ALL
SELECT 'C','德州','' UNION ALL
SELECT 'C','东营','' UNION ALL
SELECT 'C','菏泽','' UNION ALL
SELECT 'C','济南','' UNION ALL
SELECT 'C','济宁','' UNION ALL
SELECT 'C','莱芜','' UNION ALL
SELECT 'C','聊城','' UNION ALL
SELECT 'C','临沂(yi)','' UNION ALL
SELECT 'C','日照','' UNION ALL
SELECT 'C','泰安','' UNION ALL
SELECT 'C','威海','' UNION ALL
SELECT 'C','潍坊','' UNION ALL
SELECT 'C','烟台','' UNION ALL
SELECT 'C','枣庄','' UNION ALL
SELECT 'C','淄博','' UNION ALL
SELECT 'D','安阳','' UNION ALL
SELECT 'D','鹤壁','' UNION ALL
SELECT 'D','济源','' UNION ALL
SELECT 'D','焦作','' UNION ALL
SELECT 'D','开封','' UNION ALL
SELECT 'D','洛阳','' UNION ALL
SELECT 'D','漯河','' UNION ALL
SELECT 'D','南阳','' UNION ALL
SELECT 'D','平顶山','' UNION ALL
SELECT 'D','濮阳','' UNION ALL
SELECT 'D','三门峡','' UNION ALL
SELECT 'D','商丘','' UNION ALL
SELECT 'D','新乡','' UNION ALL
SELECT 'D','信阳','' UNION ALL
SELECT 'D','许昌','' UNION ALL
SELECT 'D','郑州','' UNION ALL
SELECT 'D','周口','' UNION ALL
SELECT 'D','驻马店','' UNION ALL
SELECT 'E','天津','' UNION ALL
SELECT 'F','重庆','' UNION ALL
SELECT 'G','福州','' UNION ALL
SELECT 'G','龙岩','' UNION ALL
SELECT 'G','南平','' UNION ALL
SELECT 'G','宁德','' UNION ALL
SELECT 'G','莆田','' UNION ALL
SELECT 'G','泉州','' UNION ALL
SELECT 'G','三明','' UNION ALL
SELECT 'G','厦门','' UNION ALL
SELECT 'G','漳州','' UNION ALL
SELECT 'H','长沙','' UNION ALL
SELECT 'H','常德','' UNION ALL
SELECT 'H','郴州','' UNION ALL
SELECT 'H','衡阳','' UNION ALL
SELECT 'H','怀化','' UNION ALL
SELECT 'H','吉首','' UNION ALL
SELECT 'H','娄底','' UNION ALL
SELECT 'H','邵阳','' UNION ALL
SELECT 'H','湘潭','' UNION ALL
SELECT 'H','益阳','' UNION ALL
SELECT 'H','永州','' UNION ALL
SELECT 'H','岳阳','' UNION ALL
SELECT 'H','张家界','' UNION ALL
SELECT 'H','株洲','' UNION ALL
SELECT 'I','深圳','' UNION ALL
SELECT 'J','安庆','' UNION ALL
SELECT 'J','蚌埠','' UNION ALL
SELECT 'J','巢湖','' UNION ALL
SELECT 'J','池州','' UNION ALL
SELECT 'J','滁州','' UNION ALL
SELECT 'J','阜(fu)阳','' UNION ALL
SELECT 'J','毫州','' UNION ALL
SELECT 'J','合肥','' UNION ALL
SELECT 'J','淮北','' UNION ALL
SELECT 'J','淮南','' UNION ALL
SELECT 'J','黄山','' UNION ALL
SELECT 'J','六(lu)安','' UNION ALL
SELECT 'J','马鞍山','' UNION ALL
SELECT 'J','宿州','' UNION ALL
SELECT 'J','铜陵','' UNION ALL
SELECT 'J','芜湖','' UNION ALL
SELECT 'J','宣城','' UNION ALL
SELECT 'K','大连','' UNION ALL
SELECT 'L','青岛','' UNION ALL
SELECT 'M','宁波','' UNION ALL
SELECT 'N','保定','' UNION ALL
SELECT 'N','沧州','' UNION ALL
SELECT 'N','承德','' UNION ALL
SELECT 'N','邯郸','' UNION ALL
SELECT 'N','衡水','' UNION ALL
SELECT 'N','廊坊','' UNION ALL
SELECT 'N','秦皇岛','' UNION ALL
SELECT 'N','石家庄','' UNION ALL
SELECT 'N','唐山','' UNION ALL
SELECT 'N','邢台','' UNION ALL
SELECT 'N','张家口','' UNION ALL
SELECT 'O','大庆','' UNION ALL
SELECT 'O','大兴安岭','' UNION ALL
SELECT 'O','哈尔滨','' UNION ALL
SELECT 'O','鹤岗','' UNION ALL
SELECT 'O','黑河','' UNION ALL
SELECT 'O','鸡西','' UNION ALL
SELECT 'O','佳木斯','' UNION ALL
SELECT 'O','牡丹江','' UNION ALL
SELECT 'O','齐齐哈尔','' UNION ALL
SELECT 'O','绥化','' UNION ALL
SELECT 'O','伊春','' UNION ALL
SELECT 'P','保山','' UNION ALL
SELECT 'P','楚雄','' UNION ALL
SELECT 'P','大理','' UNION ALL
SELECT 'P','德宏','' UNION ALL
SELECT 'P','红河','' UNION ALL
SELECT 'P','景洪','' UNION ALL
SELECT 'P','昆明','' UNION ALL
SELECT 'P','丽江','' UNION ALL
SELECT 'P','临沧','' UNION ALL
SELECT 'P','曲靖','' UNION ALL
SELECT 'P','思茅','' UNION ALL
SELECT 'P','文山','' UNION ALL
SELECT 'P','玉溪','' UNION ALL
SELECT 'P','昭通','' UNION ALL
SELECT 'Q','白城','' UNION ALL
SELECT 'Q','长春','' UNION ALL
SELECT 'Q','吉林','' UNION ALL
SELECT 'Q','辽源','' UNION ALL
SELECT 'Q','四平','' UNION ALL
SELECT 'Q','松原','' UNION ALL
SELECT 'Q','通化','' UNION ALL
SELECT 'Q','延吉','' UNION ALL
SELECT 'R','长治','' UNION ALL
SELECT 'R','大同','' UNION ALL
SELECT 'R','晋城','' UNION ALL
SELECT 'R','晋中','' UNION ALL
SELECT 'R','临汾','' UNION ALL
SELECT 'R','吕梁','' UNION ALL
SELECT 'R','朔州','' UNION ALL
SELECT 'R','太原','' UNION ALL
SELECT 'R','忻州','' UNION ALL
SELECT 'R','阳泉','' UNION ALL
SELECT 'R','运城','' UNION ALL
SELECT 'S','阿克苏','' UNION ALL
SELECT 'S','博州','' UNION ALL
SELECT 'S','昌吉','' UNION ALL
SELECT 'S','哈密','' UNION ALL
SELECT 'S','喀什(kashi)','' UNION ALL
SELECT 'S','克拉玛依','' UNION ALL
SELECT 'S','库尔勒','' UNION ALL
SELECT 'S','奎屯','' UNION ALL
SELECT 'S','石河子','' UNION ALL
SELECT 'S','塔城','' UNION ALL
SELECT 'S','吐鲁番','' UNION ALL
SELECT 'S','乌鲁木齐','' UNION ALL
SELECT 'S','伊犁','' UNION ALL
SELECT 'T','抚州','' UNION ALL
SELECT 'T','赣gan州','' UNION ALL
SELECT 'T','吉安','' UNION ALL
SELECT 'T','景德镇','' UNION ALL
SELECT 'T','九江','' UNION ALL
SELECT 'T','南昌','' UNION ALL
SELECT 'T','萍乡','' UNION ALL
SELECT 'T','上饶','' UNION ALL
SELECT 'T','新余','' UNION ALL
SELECT 'T','宜春','' UNION ALL
SELECT 'T','鹰潭','' UNION ALL
SELECT 'U','百色','' UNION ALL
SELECT 'U','北海','' UNION ALL
SELECT 'U','桂林','' UNION ALL
SELECT 'U','河池','' UNION ALL
SELECT 'U','贺州','' UNION ALL
SELECT 'U','来宾','' UNION ALL
SELECT 'U','柳州','' UNION ALL
SELECT 'U','南宁','' UNION ALL
SELECT 'U','钦州','' UNION ALL
SELECT 'U','梧州','' UNION ALL
SELECT 'U','玉林','' UNION ALL
SELECT 'V','巴彦淖尔','' UNION ALL
SELECT 'V','包头','' UNION ALL
SELECT 'V','赤峰','' UNION ALL
SELECT 'V','鄂尔多斯','' UNION ALL
SELECT 'V','呼和浩特','' UNION ALL
SELECT 'V','呼伦贝尔','' UNION ALL
SELECT 'V','通辽','' UNION ALL
SELECT 'V','乌海','' UNION ALL
SELECT 'V','乌兰察布','' UNION ALL
SELECT 'V','锡林郭勒','' UNION ALL
SELECT 'W','白银','' UNION ALL
SELECT 'W','酒泉','' UNION ALL
SELECT 'W','兰州','' UNION ALL
SELECT 'W','天水','' UNION ALL
SELECT 'W','武威','' UNION ALL
SELECT 'W','张掖','' UNION ALL
SELECT 'X','宁夏','' UNION ALL
SELECT 'Y','安顺','' UNION ALL
SELECT 'Y','毕节','' UNION ALL
SELECT 'Y','贵阳','' UNION ALL
SELECT 'Y','六盘水','' UNION ALL
SELECT 'Y','黔东南','' UNION ALL
SELECT 'Y','黔南','' UNION ALL
SELECT 'Y','黔西南(兴义)','' UNION ALL
SELECT 'Y','铜仁','' UNION ALL
SELECT 'Y','遵义','' UNION ALL
SELECT 'Z','青海','' SELECT * FROM dbo.y_City

城市区号

下载地址:城市区号

城市区号SQL的更多相关文章

  1. 支付宝小程序开发——获取位置API没有城市区号的最佳处理方案

    前言: 需要对城市区号进行判断,但是支付宝小程序提供的my.getLocation() API返回的数据中只有6位的城市行政代码,诸如:深圳(440300),并没有区号(0755),那么怎么办呢? 需 ...

  2. 中国城市区号脚本-mysql

    中国城市区号 300个. SET NAMES utf8mb4; ; DROP TABLE IF EXISTS `citycode`; CREATE TABLE `citycode` ( `codeId ...

  3. 简易发号SQL,可用于生成指定前缀自增序列,如订单号,生成优惠券码等

    需求1:订单号要求唯一.长度不太长.自增.但不能通过早上订单号和晚上订单号相减推算出平台大概一天的单量 需求2:要求生成10w张优惠券,要求券码唯一.不能太长,不能轻易猜测出其他券码 根据这些需求提供 ...

  4. 转 oracle 正则表达式和查询最大文件号 SQL

    ###sample 1 https://www.cnblogs.com/lxl57610/p/8227599.html Oracle使用正则表达式离不开这4个函数: 1.regexp_like 2.r ...

  5. 取客户的银行帐号SQL

    SELECT ibybanks.bank_name, --银行 ibybanks.bank_branch_name, --分行 ibybanks.bank_account_num_electronic ...

  6. sql server 更新表,每天的数据分固定批次设置批次号sql

    按表中的字段 UpdateTime 按每天进行编号,每天的编号都从1开始编号,并附带表的主键 cid,把数据存入临时表中 WITH temp AS (SELECT cid,updatetime, RO ...

  7. 国际电话区号SQL

    CREATE TABLE `phone_prefix` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `country` varchar(30) N ...

  8. SQL 多并发 多人取号,防止重复取号SQL 办法

    BEGIN TRAN         SELECT  *  from 表明 WITH(HOLDLOCK)        UPDATE 表名 SET 值=1 WHERE 字段=@carrierNo;   ...

  9. python2爬取国家统计局全国省份城市区街道信息

    工作中,再次需要python,发现python用得好 ,真的可以节省很多人力,先说我的需求,需要做一个类似像支付宝添加收货地址时,选择地区的功能,需要详细到街道信息,也就是4级联动,如右图.首先需要的 ...

随机推荐

  1. SQL 在表中随机取数据

    在一张10万行产品表(Product)中,随机取10条数据的几种方式: SET STATISTICS IO ON SELECT TOP 10 ID FROM dbo.Product(NOLOCK) W ...

  2. mysql连接其他表删除某个表的数据

    delete a from TableA a left join TableB b on a.XX = b.YY left join TableC c on c.ZZ = a.XX where 条件

  3. Linux常用压缩和解压命令

    .tar 解包 tar xvf filename.tar.tar 打包 tar cvf filename.tar dirname.gz 解压1 gunzip filename.gz.gz 解压2 gz ...

  4. TCP/IP详解--TCP首部选项中时间戳选项

    一.简介 TCP时间戳选项会在TCP包头增加12个字节,以一种比重发超时更精确的方法来启用对RTT 的计算.   二.作用 ) TCP时间戳位于TCP选项中,kind=:lenth=:data由tim ...

  5. cut

    cut是一个针对行的数据选取命令 SYNOPSIS cut [OPTION]... [FILE]... OPTION -b 以字节为单位进行分割,如果是多字节的话就需要注意了 -c 以字符为单位进行分 ...

  6. Excel demo in SSIS

    需求如下,把异常数据从sqlserver数据库中取出来,然后导入到xls中去,然后再发邮件给用户,把xls作为附件发送. 需要的示例数据表: /* create table abnormaldata( ...

  7. Linux 系统常用命令汇总(六) 文件打包与压缩

    文件打包与压缩 命令 选项 注解 示例 compress 文件名 压缩指定的文件,压缩后的格式为*.z compress install.log -d 解压被压缩的文件  .z为后缀的文件:compr ...

  8. LeetCode题解-----First Missing Positive

    Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0]  ...

  9. IOS Orientation, 想怎么转就怎么转~~~

    此博文主要针对IOS应用, 是屏幕旋转相关问题的一个总结. 主要内容有: IOS5,6,7不同版的适配. 强制旋转和自动旋转. 博客: http://www.cnblogs.com/jhzhu 邮箱: ...

  10. hdu-5929 Basic Data Structure(双端队列+模拟)

    题目链接: Basic Data Structure Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 65536/65536 K (Ja ...