处理数据批量生成sql插入语句

最近在做一个天气预报模块,首先需要将客户端公网ip转换成所在城市,然后将所在城市名转换成对应的城市代码, 在网上找到了城市代码,但是需要处理一下,看了看,有三百多城市及对应的城市代码,想存到数据库。就想着做一个 数据处理自动生成sql语句的工具,提高效率。

直辖市
    "北京","上海","天津","重庆"
    "101010100","101020100","101030100","101040100"

特别行政区
    "香港","澳门"
    "101320101","101330101"

黑龙江
    "哈尔滨","齐齐哈尔","牡丹江","大庆","伊春","双

鸭山","鹤岗","鸡西","佳木斯","七台河","黑河

","绥化","大兴安岭"

"101050101","101050201","101050301","101050901","101050801&q

uot;,"101051301","101051201","101051101","101050401","101051

002","101050601","101050501","101050701"

吉林
    "长春","延吉","吉林","白山","白城","四平

","松原","辽源","大安","通化"

"101060101","101060301","101060201","101060901","101060601&q

uot;,"101060401","101060801","101060701","101060603","101060

501"

辽宁
    "沈阳","大连","葫芦岛","盘锦","本溪","抚顺

","铁岭","辽阳","营口","阜新","朝阳","锦州

","丹东","鞍山"

"101070101","101070201","101071401","101071301","101070501&q

uot;,"101070401","101071101","101071001","101070801","101070

901","101071201","101070701","101070601","101070301"

内蒙古
    "呼和浩特","呼伦贝尔","锡林浩特","包头","赤峰

","海拉尔","乌海","鄂尔多斯","通辽"

"101080101","101081000","101080901","101080201","101080601&q

uot;,"101081001","101080301","101080701","101080501"

河北
    "石家庄","唐山","张家口","廊坊","邢台","邯郸

","沧州","衡水","承德","保定","秦皇岛"

"101090101","101090501","101090301","101090601","101090901&q

uot;,"101091001","101090701","101090801","101090402","101090

201","101091101"

河南
    "郑州","开封","洛阳","平顶山","焦作","鹤壁

","新乡","安阳","濮阳","许昌","漯河","三门峡

","南阳","商丘","信阳","周口","驻马店"

"101180101","101180801","101180901","101180501","101181101&q

uot;,"101181201","101180301","101180201","101181301","101180

401","101181501","101181701","101180701","101181001","1

01180601","101181401","101181601"

山东
    "济南","青岛","淄博","威海","曲阜","临沂

","烟台","枣庄","聊城","济宁","菏泽","泰安

","日照","东营","德州","滨州","莱芜","潍坊

"

"101120101","101120201","101120301","101121301","101120710&q

uot;,"101120901","101120501","101121401","101121701","101120

701","101121001","101120801","101121501","101121201","1

01120401","101121101","101121601","101120601"

山西
    "太原","阳泉","晋城","晋中","临汾","运城

","长治","朔州","忻州","大同","吕梁"

"101100101","101100301","101100601","101100401","101100701&q

uot;,"101100801","101100501","101100901","101101001","101100

201","101101101"

江苏
    "南京","苏州","昆山","南通","太仓","吴县

","徐州","宜兴","镇江","淮安","常熟","盐城

","泰州","无锡","连云港","扬州","常州","宿迁

"

"101190101","101190401","101190404","101190501","101190408&q

uot;,"101190406","101190801","101190203","101190301","101190

901","101190402","101190701","101191201","101190201","1

01191001","101190601","101191101","101191301"

安徽
    "合肥","巢湖","蚌埠","安庆","六安","滁州

","马鞍山","阜阳","宣城","铜陵","淮北","芜湖

","毫州","宿州","淮南","池州"

"101220101","101221601","101220201","101220601","101221501&q

uot;,"101221101","101220501","101220801","101221401","101221

301","101221201","101220301","101220901","101220701","1

01220401","101221701"

陕西
    "西安","韩城","安康","汉中","宝鸡","咸阳

","榆林","渭南","商洛","铜川","延安"

"101110101","101110510","101110701","101110801","101110901&q

uot;,"101110200","101110401","101110501","101110601","101111

001","101110300"

宁夏
    "银川","固原","中卫","石嘴山","吴忠"

"101170101","101170401","101170501","101170201","101170301&q

uot;

甘肃
    "兰州","白银","庆阳","酒泉","天水","武威

","张掖","甘南","临夏","平凉","定西","金昌

"

"101160101","101161301","101160401","101160801","101160901&q

uot;,"101160501","101160701","101050204","101161101","101160

301","101160201","101160601"

青海
    "西宁","海北","海西","黄南","果洛","玉树

","海东","海南"

"101150101","101150801","101150701","101150301","101150501&q

uot;,"101150601","101150201","101150401"

湖北
    "武汉","宜昌","黄冈","恩施","荆州","神农架

","十堰","咸宁","襄阳","孝感","随州","黄石

","荆门","鄂州"
"101200101","101200901","101200501","101201001","101200801&q

uot;,"101201201","101201101","101200701","101200201","101200

401","101201301","101200601","101201401","101200301"

湖南
    "长沙","邵阳","常德","郴州","吉首","株洲

","娄底","湘潭","益阳","永州","岳阳","衡阳

","怀化","韶山","张家界"

"101250101","101250901","101250601","101250501","101251501&q

uot;,"101250301","101250801","101250201","101250701","101251

401","101251001","101250401","101251201","101250202","1

01251101"

浙江
    "杭州","湖州","金华","宁波","丽水","绍兴

","衢州","嘉兴","台州","舟山","温州"

"101210101","101210201","101210901","101210401","101210801&q

uot;,"101210501","101211001","101210301","101210601","101211

101","101210701"

江西
    "南昌","萍乡","九江","上饶","抚州","吉安

","鹰潭","宜春","新余","景德镇","赣州"

"101240101","101240901","101240201","101240301","101240401&q

uot;,"101240601","101241101","101240501","101241001","101240

801","101240701"

福建
    "福州","厦门","龙岩","南平","宁德","莆田

","泉州","三明","漳州"

"101230101","101230201","101230701","101230901","101230301&q

uot;,"101230401","101230501","101230801","101230601"

贵州
    "贵阳","安顺","赤水","遵义","铜仁","六盘水

","毕节","凯里","都匀"

"101260101","101260301","101260208","101260201","101260601&q

uot;,"101260801","101260701","101260501","101260401"

四川
    "成都","泸州","内江","凉山","阿坝","巴中

","广元","乐山","绵阳","德阳","攀枝花","雅安

","宜宾","自贡","甘孜州","达州","资阳","广安

","遂宁","眉山","南充"

"101270101","101271001","101271201","101271601","101271901&q

uot;,"101270901","101272101","101271401","101270401","101272

001","101270201","101271701","101271101","101270301","1

01271801","101270601","101271301","101270801","101270701",&q

uot;101271501","101270501"

广东
    "广州","深圳","潮州","韶关","湛江","惠州

","清远","东莞","江门","茂名","肇庆","汕尾

","河源","揭阳","梅州","中山","德庆","阳江

","云浮","珠海","汕头","佛山"

"101280101","101280601","101281501","101280201","101281001&q

uot;,"101280301","101281301","101281601","101281101","101282

001","101280901","101282101","101281201","101281901","1

01280401","101281701","101280905","101281801","101281401",&q

uot;101280701","101280501","101280800"

广西
    "南宁","桂林","阳朔","柳州","梧州","玉林

","桂平","贺州","钦州","贵港","防城港","百色

","北海","河池","来宾","崇左"

"101300101","101300501","101300510","101300301","101300601&q

uot;,"101300901","101300802","101300701","101301101","101300

801","101301401","101301001","101301301","101301201","1

01300401","101300201"

云南
    "昆明","保山","楚雄","德宏","红河","临沧

","怒江","曲靖","思茅","文山","玉溪","昭通

","丽江","大理"

"101290101","101290501","101290801","101291501","101290301&q

uot;,"101291101","101291201","101290401","101290901","101290

601","101290701","101291001","101291401","101290201"

海南
    "海口","三亚","儋州","琼山","通什","文昌"

"101310101","101310201","101310205","101310102","101310222&q

uot;,"101310212"

新疆
    "乌鲁木齐","阿勒泰","阿克苏","昌吉","哈密","和

田","喀什","克拉玛依","石河子","塔城","库尔勒

","吐鲁番","伊宁"

"101130101","101131401","101130801","101130401","101131201&q

uot;,"101131301","101130901","101130201","101130301","101131

101","101130601","101130501","101131001"

西藏
    "拉萨","阿里","昌都","那曲","日喀则","山南

","林芝"

"101140101","101140701","101140501","101140601","101140201&q

uot;,"101140301","101140401"

台湾
    "台北","高雄"
    "101340102","101340201"

城市代码

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索代码
, 池州
城市
excel批量生成sql语句、批量生成sql语句、mysql批量执行sql语句、sql语句批量添加数据、批量执行sql语句,以便于您获取更多的相关知识。

时间: 2024-10-27 07:03:03

处理数据批量生成sql插入语句的相关文章

将表里的数据批量生成INSERT语句的存储过程 增强版_MsSql

有时候,我们需要将某个表里的数据全部或者根据查询条件导出来,迁移到另一个相同结构的库中 目前SQL Server里面是没有相关的工具根据查询条件来生成INSERT语句的,只有借助第三方工具(third party tools) 这种脚本网上也有很多,但是网上的脚本还是欠缺一些规范和功能,例如:我只想导出特定查询条件的数据,网上的脚本都是导出全表数据 如果表很大,对性能会有很大影响 这里有一个存储过程(适用于SQLServer2005 或以上版本) -- Author: <桦仔> -- Blog

将表里的数据批量生成INSERT语句的存储过程 增强版

有时候,我们需要将某个表里的数据全部或者根据查询条件导出来,迁移到另一个相同结构的库中 目前SQL Server里面是没有相关的工具根据查询条件来生成INSERT语句的,只有借助第三方工具(third party tools) 这种脚本网上也有很多,但是网上的脚本还是欠缺一些规范和功能,例如:我只想导出特定查询条件的数据,网上的脚本都是导出全表数据 如果表很大,对性能会有很大影响 这里有一个存储过程(适用于SQLServer2005 或以上版本) -- Author: <桦仔> -- Blog

sql 插入 行过多-sql插入语句,一次插入过多,不让插入了

问题描述 sql插入语句,一次插入过多,不让插入了 今天下载了一个全国学校数据库,把里面的信息直接插入到我之前建好的表里,结果提示错误 INSERT 语句中行值表达式的数目超出了 1000 行值的最大允许值. 我试着查1000行刚好可以,是不是插入行不能超过1000行? 那怎么样才能让我在表里插入超过1000行呢?是不是修改哪个参数之类的.... 求高手解答!!!!!!

sql 插入语句单引号和双引号问题

问题描述 sql 插入语句单引号和双引号问题 ![ 这两句语句都对吗? 解决方案 java拼sql串用双引号,sql语句里用单引号 解决方案二: SQL中的单引号和双引号sql 那些单引号双引号关于SQL 中的单引号和双引号 解决方案三: 双引号那句编译不了,双引号没加上反斜杆注明.

sql语句-SQL 插入语句 新手求指导求教育

问题描述 SQL 插入语句 新手求指导求教育 INSERT INTO U_USER VALUES( 1,小严,严,,,,,,,,,,,,,);后面的没有写就出现前三个字段列名无效.为什么? 解决方案 为varchar类型的列赋值需要用单引号引起来(1,'小严','严',,,,,,,,,,,)

java,js怎么实现生动生成sql查询语句

问题描述 java,js怎么实现生动生成sql查询语句,包括聚合函数,排序,条件生成,多表联合查询.

将mater库中的系统存储过程批量生成*.sql文件 通用且非常实用

大家都知道系统存储过程是无法用工具导出的(大家可以试试 >任务>生成SQL脚本) 因为系统存储过程一般是不让开发人员修改的. 需要知识: 1.xp_cmdshell命令的使用 2.sp_MS_marksystemobject 标记系统存储过程的方法 3.dos 命令,如 type,>> 等 4.bcp 命令的使用 复制代码 代码如下: use master go if OBJECT_ID('pr_procToSql') is not null drop proc pr_procTo

手把手教你-----巧用Excel批量生成SQL语句,处理大量数据

     在做系统或者做项目的时候,经常会遇到这样的要求:用户给我们发过来一些数据,要求我们把这些数据导入到数 据库中,对于少量的数据来说,用最原始的方法就可以解决,直接在SQL里面用语句来实现,但是如果有成千上万条的 数据呢?如果你还继续单独写SQL语句,估计写个几十条你就会有跳楼的冲动,其实有两种简单的方法:    1.将Excel的数据整理好,通过SQL的导入功能直接导入到数据库中,但是要保证数据库的字段和Excel的字段一致.    2.通过Excel生成相应的SQL语句,然后,放到SQ

动态生成SQL执行语句

SET @qry = 'SELECT product_cd, name, product_type_cd, date_offered, date_retired FROM product WHERE product_cd = ?'; PREPARE dynsql2 FROM @qry; SET @prodcd = 'CHK'; EXECUTE dynsql2 USING @prodcd; SET @prodcd = 'SAV'; EXECUTE dynsql2 USING @prodcd; DE