如果变量@id是int,那么
declare @id int
select * from yourtable where [group] like '%'+cast(@id as varchar)+'%'如果是char
declare @id char(1)
select * from yourtable where [group] like '%'+@id +'%'

解决方案 »

  1.   

    select * from table1 where group like '%4%'
      

  2.   

    to wanyingsong(豌豆) 
    谢谢!  如果 “id”是作为一个查询条件的话,该如何?
    比如就 “select * from  tablename where ?”
    ”?“里的内容怎么填?  谢谢!
      

  3.   

    select * from table1 where charindex(@id,group)>0
      

  4.   

    那就用动态语句来实现:declare @id varchar(200),@string varchar(8000)
    select @id='[group] like ''%4%'' and name=''c'''
    select @string='select * from tablename where '+@id
    --select @string
    exec(@string)