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

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

博客园 - hi-justin

O.O 一次蛮搞笑的面试 为什么老是这么忙呢? 祝自己生日快乐:) 反省一下 实现了一个一直以来梦想 Time 如何用正确的方法来写出质量好的软件的75条体会[收藏] 還有一塊錢哪去了? 爆強ERP Never forget :) 終於可以稍微輕松一下了 遇到這種問題,你會怎麼做? 美好的一天,耶 [備忘]动态显示图片 寫下來,免得下次又忘了 小記一下 過梅林海關的幾次有趣經歷
[備忘]用於分解字符串的自定義函數
hi-justin · 2004-11-21 · via 博客园 - hi-justin

/*
function name:decStoreCode
purporse:分解以逗號分開的StoreCode字符串
author:seven
create date:2004/11/20
modifer:seven
modified date:2004/8/21
use exam:
*/

CREATE FUNCTION decStoreCode
 (
    @StoreCode 
nvarchar(255)--傳入BillNo字符串
)  
RETURNS @TabStoreCode Table(StoreCode nvarchar(20))

AS  
BEGIN 
    
declare @strCurSub varchar(60)--當前的截取部分
    declare @strBehindSub varchar(255)--後面的截取部分
    declare @intCurPost int--當前的位置
    declare @intLefLen int--剩下部分的長度

    
set @intCurPost = charindex(',',@StoreCode)--得到分號的位置
    if(@intCurPost>0)
        
begin
            
set @strCurSub=substring(@StoreCode,1,@intCurPost-1);
            
set @intLefLen=len(@StoreCode)-@intCurPost
            
set @strBehindSub=substring(@StoreCode,@intCurPost+1,@intLefLen)
        
end
    
else
        
begin
            
set @strCurSub=@StoreCode
        
end

        
insert @TabStoreCode values(@strCurSub)--分解到table中
    while @intCurPost>0
        
begin
            
set @intCurPost=charindex(',',@strBehindSub)

            
if @intCurPost!=0
                
begin
                    
set @intLefLen=@intLefLen-@intCurPost
                    
set @strCurSub=substring(@strBehindSub,1,@intCurPost-1)
                    
set @strBehindSub=substring(@strBehindSub,@intCurPost+1,@intLefLen)
                
end 
            
else
                
begin
                    
set @strCurSub=@strBehindSub
                
end
                
                
insert @TabStoreCode values(@strCurSub)--分解到table中
        end
        
return--返回资料集合
END