传入sql数组字符串,输出table
时间:2021-07-01 10:21:17
帮助过:2人阅读
),@pattern varchar(
10))
returns @temp table([Sid] [int] IDENTITY (
1,
1) NOT NULL ,a varchar(
100))
--
实现split功能 的函数
--
说明:@aString,字符串,如a:b:c;@pattern,分隔标志,如 :
as
begin
declare @i int
set @aString=
rtrim(ltrim(@aString))
set @i=
charindex(@pattern,@aString)
while @i>=
1
begin
insert @temp values(left(@aString,@i-
1))
set @aString=substring(@aString,@i+
1,len(@aString)-
@i)
set @i=
charindex(@pattern,@aString)
end
if @aString<>
‘‘
insert @temp values(@aString)
return
end
传入sql数组字符串,输出table
标签: