ÓÐÒ»¸ö±äÁ¿@not @notÑ»·ÀÛ¼Ó,³ÉΪÈçÏÂ×Ö·û´®'12525,12524' È»ºóÔÚÓï¾äµÄ not in(@not) »á³ö´í:ÔÚ½« varchar Öµ '12525,12524' ת»»³ÉÊý¾ÝÀàÐÍ int ʱʧ°Ü¡£ Ôõô¿ÉÒÔ°Ñ@not±ä³ÉsqlÓï¾äµÄÒ»²¿·Ö£¿Ê¹not in (@not) ¾ÍÊÇ not in (12525,12524) SQL code: select * from tb where charindex(','+ltrim(ID)+',',''+@idlist+'')=0
where charindex(','+Rtrim(À¸Î»)+',' , ','+@not+',') = 0 ÓÃÒ»¸ö¶¯Ì¬Óï¾ä¼´¿É¡£
SQL code:
exec ('select * from tb where id not in(@not)')
SQL code: --or exec('select * from tb where id not in('+@idlist+')')
SQL code:
--Óö¯Ì¬SQL»òÕߣº select * from ±íÃû where charindex(','+ltrim(×Ö¶ÎÃû)+',',','+@not+',')>0
¾ÀÕý SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.Cod