日期:2014-05-18 浏览次数:20796 次
create table tb(ID int,name varchar(20)) insert into tb values(1,'22') insert into tb values(2,'33') insert into tb values(3,'44') create function get_str(@str varchar(20)) returns varchar(1000) as begin declare @s varchar(1000) select @s=isnull(@s+',','')+name from tb where charindex(','+ltrim(id)+',',','+@str+',')>0 return @s end select dbo.get_str('1,2')