天天看点

手机号码地市查询工具

为了处理每日让人烦躁的黑名单号码,开发了个手机号码区号查询工具

1.开发环境:jdk1.5,sql2000,eclipse3.5

2.描述:程序实现了单个号码的查询和多个号码的批量查询

界面如下:

手机号码地市查询工具
手机号码地市查询工具

项目文件在附件里。

用到的存储过程如下:

progress:

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_NULLS ON

ALTER  proc progress

@table_name varchar(20),@filePath varchar(50)

as

 if exists (select * from sysobjects where name = ''+ @table_name + '' and xtype = 'U')

 begin

  exec('drop table '+@table_name)

 end

 if exists (select * from sysobjects where name = 'sucess_result' and xtype = 'U')

  exec('drop table sucess_result')

 if exists (select * from sysobjects where name = 'fail_result' and xtype = 'U')

  exec('drop table fail_result')

 exec('create table '+@table_name+' (phone varchar(20))')

 exec('exec master..xp_cmdshell ''bcp chinasection..'+@table_name+' in '+ @filePath +' -c -T''')

 exec('select c.areacode as areacode, t.phone as phone into sucess_result from '+@table_name+' t, chinahd c where c.sectionno = left(t.phone,7)')

 exec('select * into fail_result from '+@table_name+' where phone not in (select phone from sucess_result)')

SET QUOTED_IDENTIFIER OFF

outputphone:

ALTER  proc outputphone

 exec master..xp_cmdshell 'bcp chinasection..sucess_result out D:\黑名单处理\sucess_result.txt -c -T'

 exec master..xp_cmdshell 'bcp chinasection..fail_result out D:\黑名单处理\fail_result.txt -c -T'

继续阅读