DECLARE @str NVARCHAR(1000)=‘SELECT * FROM dbo.V_MicroUserInfo ‘,@where VARCHAR(1000)=‘ where 1=1‘ DECLARE @Nature VARCHAR(200)=‘河南|周口‘ SET @where+=‘ And ‘‘‘+@Nature+‘‘‘ like ‘‘%‘‘+HuJiString+ ‘‘%‘‘ ‘ SET @str+=@where; PRINT @str EXEC sys.sp_executesql @str SELECT * FROM dbo.V_MicroUserInfo where 1=1 And ‘河南|周口市‘ like ‘%‘+HuJiString+ ‘%‘ AND CvNumber=797024 DECLARE @Nature VARCHAR(200)=‘北京|北京,河北|石家庄,山东|济南‘ SELECT * FROM dbo.V_MicroUserInfo WHERE @Nature LIKE ‘%‘+HuJiString+‘%‘ SELECT * FROM dbo.V_MicroUserInfo where 1=1 And ‘北京|北京,河北|石家庄,山东|济南‘ like ‘%‘+HuJiString+ ‘%‘