想能过 @postContent 传参数进行查询操作,
    自己写的SQL语句如下:
    select * from tPost where sPostContent like %@postContent%
   报@postContent附近有语法错误,我想是%的问题,请问该怎么写

解决方案 »

  1.   

    select * from tPost where sPostContent like '%@postContent%'
      

  2.   

    你要写什么啊 
     string @postContent   =“”
    select * from tPost where sPostContent like ‘”+@postContent+“‘
      

  3.   

    或者 
    select * from tPost where charindex(@postContent,sPostContent)>0
      

  4.   

    select * from tPost where sPostContent like @postContent传值
        xx.AddParameter("postContent", "%"+postContent+"%", DbType.String);
    类似的
      

  5.   

    exec(' select * from tPost where sPostContent like ''%'+@postContent+'%''' )