用语句拆分字符串(固定位数)
来源:互联网 发布:贾静雯颜值 知乎 编辑:程序博客网 时间:2024/06/11 20:52
with t1 as(select '1' col1 union allselect '1.22' col1 union allselect '1.22.333' col1 union allselect '1.22.333.4444' col1 union allselect '1.22.333.4444.55555' col1 union allselect '1.22.333.4444.55555.666666' col1 union allselect '1.22.333.4444.55555.666666.7777777' col1)select col1, n1, n2, n3, n4, n5, case when col6 like '%.%' then SUBSTRING(col6, 1, patindex('%.%', col6)-1) else col6 end as n6, case when col6 like '%.%' then SUBSTRING(col6, patindex('%.%', col6)+1, 100) end as n7from(select col1, n1, n2, n3, n4, case when col5 like '%.%' then SUBSTRING(col5, 1, patindex('%.%', col5)-1) else col5 end as n5, case when col5 like '%.%' then SUBSTRING(col5, patindex('%.%', col5)+1, 100) end as col6from(select col1, n1, n2, n3, case when col4 like '%.%' then SUBSTRING(col4, 1, patindex('%.%', col4)-1) else col4 end as n4, case when col4 like '%.%' then SUBSTRING(col4, patindex('%.%', col4)+1, 100) end as col5from(select col1, n1, n2, case when col3 like '%.%' then SUBSTRING(col3, 1, patindex('%.%', col3)-1) else col3 end as n3, case when col3 like '%.%' then SUBSTRING(col3, patindex('%.%', col3)+1, 100) end as col4from(select col1, n1, case when col2 like '%.%' then SUBSTRING(col2, 1, patindex('%.%', col2)-1) else col2 end as n2, case when col2 like '%.%' then SUBSTRING(col2, patindex('%.%', col2)+1, 100) end as col3from(select col1, case when col1 like '%.%' then SUBSTRING(col1, 1, patindex('%.%', col1)-1) else col1 end as n1, case when col1 like '%.%' then SUBSTRING(col1, patindex('%.%', col1)+1, 100) end as col2from t1) t2) t3) t4) t5) t6
0 0
- 用语句拆分字符串(固定位数)
- python字符串按固定长度拆分
- 整数转换成固定位数的字符串
- sql学用语句
- sql中常用语句
- SCREEN中常用语句
- Oracle 便用语句
- 工作中常用语句
- js中常用语句
- Oracle中常用语句
- mysql不常用语句
- JavaScript中常用语句
- JDBC系列教程(六)---可调用语句
- 英语日常用语100句
- 英语日常用语百句
- 日语常用语3000句
- 商务午餐中常用语句
- 存储过程中常用语句
- 第二章第十七题
- 习题2—14
- PHP开发框架--CodeIgniter(CI)使用总结
- Apache Tomcat环境变量配置
- 免费接口API
- 用语句拆分字符串(固定位数)
- 调用odata返回406 not acceptable解决方案
- C#多线程初探
- 如何封装RESTful Web Service
- json字符串与Object、List、Map的互转工具类
- LRU Cache
- 用到jQuery的web2.0技术(译)
- c计算sin()函数的近似值,不使用函数库
- 第二章第一题