ZL_StringSplitTable
GO
Create Function [dbo].[ZL_StringSplitTable](@str varchar(8000))
Returns @tableName Table ( ZLID varchar(100) )
As
Begin
set @str = @str+','
Declare @insertStr varchar(100)
Declare @newstr varchar(8000)
set @insertStr = left(@str,charindex(',',@str)-1)
set @newstr = stuff(@str,1,charindex(',',@str),'')
Insert @tableName Values(@insertStr)
while(len(@newstr)>0)
begin
set @insertStr = left(@newstr,charindex(',',@newstr)-1)
Insert @tableName Values(@insertStr)
set @newstr = stuff(@newstr,1,charindex(',',@newstr),'')
end
Return
End
detele from ZL_StringSplitTable
drop table ZL_StringSplitTable
TRUNCATE table ZL_StringSplitTable