select datepart(dd,dateadd(dd,-1,dateadd(mm,1,cast(cast(year(getdate()) as varchar)+'-'+cast(month(getdate()) as varchar)+'-01' as datetime))))
declare @str varchar(20),@strSql varchar(8000)
set @str = 'a,bc,d,abce,ddz,78787' -- 此处的字符串可以随心所欲的更改
if object_id('tempdb.dbo.#temp1') is null
create table #temp1(item varchar(20))
else
truncate table #temp1
SELECT @strSql='insert into #temp1 values('''+REPLACE(@str,',',''') insert into #temp1 values(''')+''')'
print @strSql
exec (@strSql)
select * from #temp1