标签:style blog class code color http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 |
/*按照符号分割字符串*/ create function [dbo].[m_split](@c varchar (2000),@split varchar (2)) returns
@t table (col varchar (200)) as begin while(charindex(@split,@c)<>0) begin insert
@t(col) values
( substring (@c,1,charindex(@split,@c)-1)) set
@c = stuff(@c,1,charindex(@split,@c), ‘‘ ) -- SET @c = substring(@c,charindex(‘ ‘,@c)+1,len(@c)) end insert
@t(col) values
(@c) return end select
* from dbo.m_split( ‘1,2,3,4,5‘ , ‘,‘ ) |
SQL中自定义拆分为新表的函数,布布扣,bubuko.com
标签:style blog class code color http
原文地址:http://www.cnblogs.com/songxingzhu/p/3708951.html