create function f_split(@col1 varchar(8000),@col varchar(2))
returns @t table(col varchar(50))
as
begin
declare @i int
set @i=len(@col1+'a')-2
while charindex(@col,@col1)>0
begin
insert @t values (left(@col1,charindex(',',@col1)-1))
select @col1=stuff(@col1,1,charindex(',',@col1),'')
end
insert @t values (@col1)
return
end
go


declare @s varchar(8000)
set @s='1234567891,1234567892,1234567893,1234567894'

insert tb(字段)
select * from dbo.f_split(@s,',')

drop function f_split

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-08-19
  • 2022-01-19
  • 2021-12-11
  • 2021-09-19
猜你喜欢
  • 2022-01-02
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案