查询表中含有某个字符串的所有行,请问要怎么写?

解决方案 »

  1.   

    1、select * from table where columnname like '%字符串%'
    2、select * from table where patindex('%字符串%',columnname)>0
      

  2.   

    select *
    from tb
    where charindex('某字符串',col)>0
      

  3.   

    select * from tb where charindex('某字符串',列名)>0
      

  4.   


    --查询所有列的话就用*
    select * from table where columnname like '%字符串%'
    --这样可以,但是如果数据量过大的话速度会有所影响
      

  5.   

    select * from table where columnname like '%string%'