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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - seamanhy

Android Studio 安装说明 Google——Tracking Code, Map Api ASP.NET输出到Excel - seamanhy - 博客园 GridView中BoundField重复绑定数据 一个等待的小功能 MS SQL 区分大小写 盗链 防止盗链 防止图片盗链 HTML编辑器 免费编辑器 中文免费HTML编辑器 URLReWriter ASP.NET 页面跳转 伪静态页面 多参数 VBSCRIPT控制网页打印页眉和页脚 - seamanhy - 博客园 一个免费的天气预报WebService 常用正则表达式 - seamanhy - 博客园 推荐一个SQL分页函数 一些网站中经常使用的插件 PNG24在IE6中不正常显示的问题 DataSet导入到Excel文件 Google拼音输入法字库分析程序 查看SQL Server 2000执行时间 SQL Server将数据库中多行中的某个字段转换为字符串
SQL Server将字符串转换为多行
seamanhy · 2007-07-27 · via 博客园 - seamanhy

调用这个方式时输入参数(1,2,3,4,5),返回结果
Id
1
2
3
4
5

CREATE FUNCTION convertCharToMultiRows(@convertString varchar(8000), 
@strSeprate varchar(10)) RETURNS @temp TABLE (Id int
AS BEGIN DECLARE @i int
SET @convertString = rtrim(ltrim(@convertString))
SET @i = charindex(@StrSeprate@convertStringWHILE @i >= 1 BEGIN INSERT 
      
@temp
VALUES (LEFT(@convertString@i - 1))
SET @convertString = substring(@convertString@i + 1len(@convertString- @i)
SET @i = charindex(@StrSeprate@convertStringEND IF @convertString <> '\' INSERT 
      
@temp
VALUES (CONVERT(int@convertString)) RETURN END