存到表内
declare @string varchar(1000)
set @string='aaaa,bbbb,cccc,dddd'
set @string='select * into ##tmp from (select '''+replace(@string,',','''as str union all select ''')+''') a'
exec(@string)
select * from ##tmp
drop table ##tmp
declare @string varchar(1000)
set @string='aaaa,bbbb,cccc,dddd'
set @string='select * into ##tmp from (select '''+replace(@string,',','''as str union all select ''')+''') a'
exec(@string)
select * from ##tmp
drop table ##tmp
create table #临时表(a varchar(8000))
set @string='aaaa,bbbb,cccc,dddd'
set @string='select * from (select '''+replace(@string,',','''as str union all select ''')+''') a'
exec('insert #临时表 '+@string)
select * from #临时表
drop table #临时表