日期:2014-05-17 浏览次数:20521 次
create table #temp(idnum VARCHAR(6),idname varchar(20)) insert into #temp values('id1','7,') insert into #temp values('id2','7,100,') insert into #temp values('id3','77,100,') declare @str VARCHAR(10) set @str='7,' select * from #temp where PATINDEX(@str+'%',idname)>0 /* idnum idname ------ -------------------- id1 7, id2 7,100, (2 行受影响) */