拼写sql语句随笔

  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+ ‘%‘ 

  

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。