要求取得字符串aa
當然
ALTER function [dbo]
(
@str varchar(
@split char(
@index int
)
returns varchar(
begin
declare @count int
declare @s varchar(
set @count =
set @s =
while(charindex(@split
begin
if @count = @index begin
set @s = substring(@str
break
end
set @str = stuff(@str
set @count = @count +
end
if charindex(@split
set @s = @str
end
return @s
end
例如select dbo
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22268.html