fnCSVStringToTable
Return
Return Type |
---|
table |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@sIDs | varchar(8000) | IN |
Definition
Copy
CREATE function [dbo].[fnCSVStringToTable]
(
@sIDs varchar(8000)
)
returns @IDs table (id varchar(150))
as
begin
declare @i int
declare @j int
set @i = 1
while @i <= len(@sIDs)
begin
select @j = charindex(',', @sIDs, @i)
if @j = 0
begin
select @j = len(@sIDs) + 1
end
insert @IDs select substring(@sIDs, @i, @j - @i)
select @i = @j + 1
end
return
end