陪伴而非守候
如果字段只是(1)(2)(3)(4)中的一个,比如(1)可以这样use Testdb2goIF NOT OBJECT_ID('[t_Demo]') IS NULL DROP TABLE [t_Demo]GOCREATE TABLE [t_Demo]([ID] int identity(1,1) primary key not null,[Cate] Nvarchar(20) null)goINSERT [t_Demo]SELECT '(1)' union allSELECT '(2)' union allSELECT '(3)' union allSELECT '(4)' union allSELECT '(2)' union allSELECT '(1)' goDeclare @vars nvarchar(100)set @Vars='1,2,3,5'Declare @strSql Nvarchar(max)set @strSql='select * from [t_Demo] where Replace(Replace([Cate],''('',''''),'')'','''') in ('+@Vars+')'print @strSqlexec (@strSql)/*select * from [t_Demo] where Replace(Replace([Cate],'(',''),')','') in (1,2,3,5)(5 row(s) affected)ID Cate1 (1)2 (2)3 (3)5 (2)6 (1)