惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threat Research - Cisco Blogs
V2EX - 技术
V2EX - 技术
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
Recorded Future
Recorded Future
S
Schneier on Security
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The GitHub Blog
The GitHub Blog
S
Security @ Cisco Blogs
O
OpenAI News
W
WeLiveSecurity
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
人人都是产品经理
人人都是产品经理
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
NISL@THU
NISL@THU
T
Tailwind CSS Blog
V
Visual Studio Blog
PCI Perspectives
PCI Perspectives
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
D
DataBreaches.Net
B
Blog RSS Feed
N
News and Events Feed by Topic
N
News and Events Feed by Topic
H
Heimdal Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
腾讯CDC
Latest news
Latest news
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
V
V2EX
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
Help Net Security
Help Net Security

博客园 - nerozhang

NHibernate小结(一) 数据库中的字符串操作 通过查询语句链接到远程数据库 得到数据库表的结构 从两张表中取出不一致的数据 NHibernate Quick Start Guide 唐诗赏析--唐诗的起源,发展 PetShop 4.0的缓存处理 AggregateCacheDependency、CacheDependency、SqlCacheDependency Asp.net 2.0和PetShop4 的缓存示例 自定义 HttpModule 示例 在global.asax中实现URL重写(应用) Community Starter Kit - 结构 Community Starter Kit - 功能介绍 Community Starter Kit -简介 Petshop 4.0学习-MasterPage.master文件 PetShop 4.0学习-数据访问层之数据库访问设计 PetShop 4.0学习--登录以及注册功能的分析 PetShop 4.0学习--体系架构 PetShop 4.0学习--业务功能介绍
数据库字符串处理
nerozhang · 2008-03-13 · via 博客园 - nerozhang

declare @sql varchar(1024)
declare @oldhscodepatten varchar(50)
declare @newhscodepatten varchar(50)
declare @corpidpatten varchar(50)
declare @chinesenamepatten varchar(50)
declare @newchinesenamepatten varchar(50)
declare @oldhscode varchar(50)
declare @newhscode varchar(50)
declare @corpid varchar(50)
declare @chinesename varchar(50)
declare @newchinesename varchar(50)

declare @i int
declare @j int

set @oldhscodepatten='Set @oldHsCode='--匹配字符串
set @newhscodepatten='Set @newHsCode='--匹配字符串
set @corpidpatten='Set @corpid='--匹配字符串
set @chinesenamepatten='Set @chinesename='--匹配字符串
set @newchinesenamepatten='Set @newchinesename='--匹配字符串

--set nocount off
DECLARE @temp TABLE (corpid char(4) ,
oldhscode 
varchar(110),
newhscode 
varchar(110),
chinesename 
varchar(50),
newchinesename 
varchar(50)
)
--查询字符串信息
DECLARE c0 CURSOR FOR     
select modifysql from modifyrec
where modifylocation='海关' and convert(char(10),modifytime,120)>='2008-01-01'
and modifybilltype='修改HS编码' and modifysql not like '%update firstcheck%'
OPEN c0                    --打开游标
FETCH NEXT FROM c0 INTO @sql
WHILE @@FETCH_STATUS=0
BEGIN
--oldhsode
    select @i=charindex(@oldhscodepatten,@sql)+15
    
select @oldhscode=substring(@sql,@i,13)
    
select @oldhscode=replace(@oldhscode,'''','')
--newhscode
    select @i=charindex(@newhscodepatten,@sql)+15
    
select @newhscode=substring(@sql,@i,13)
    
select @newhscode=replace(@newhscode,'''','')
--corpid
    select @i=charindex(@corpidpatten,@sql)+13
    
select @corpid=substring(@sql,@i,4)

SET QUOTED_IDENTIFIER OFF--设置区分符号
--
chinesename
    select @i=charindex(@chinesenamepatten,@sql)+18
    
select @chinesename=substring(@sql,@i,50)
    
print @chinesename
    
select @j=charindex("'",@chinesename)--'改为"
    
if @j>0
        
select @chinesename=substring(@sql,@i,@j-1)
--newchinesename
    select @i=charindex(@newchinesenamepatten,@sql)+21
    
select @newchinesename=substring(@sql,@i,50)
    
print @newchinesename
    
select @j=charindex("'",@newchinesename)
    if @j=0
        set @newchinesename=@chinesename
    else
        select @newchinesename=substring(@sql,@i,@j-1)
    --插入到表变量
    insert @temp(corpid,oldhscode,newhscode,chinesename,newchinesename)
        values(@corpid,@oldhscode,@newhscode,@chinesename,@newchinesename)
    --insert @temp(corpid,oldhscode,newhscode)
        --values(@corpid,@oldhscode,@newhscode)
    
FETCH NEXT FROM c0 INTO @sql
END
CLOSE c0
DEALLOCATE c0    

select * from @temp
order by corpid,oldhscode,newhscode