其实应该用另外一种形式来表示。比如查C开头的,就输入c..,然后以此类推。
自己写个程序把C..进行转换

解决方案 »

  1.   

    This example shows how to search for the string “50% off when 100 or more copies are purchased” in the notes column of the titles table in the pubs database:USE pubsGOSELECT notesFROM titlesWHERE notes LIKE '50%% off when 100 or more copies are purchased'     ESCAPE '%'GO
      

  2.   

    比如说我想在csdn数据库中查一个以'wyb_'打头的所有用户!
    写法如下select * from user where username like 'wyb_%'
    由于'_'是通配符,结果所有以'wyb'打头的数据都列出来了,而不是想要的以'wyb_'打头的所有数据!
    不知要实出这样的查询该怎么办?
      

  3.   

    再看一个例子:
    This example uses the ESCAPE clause and the escape character to find the exact character string 10-15% in column c1 of the mytbl2 table.USE pubs
    GO
    IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
            WHERE TABLE_NAME = 'mytbl2')
        DROP TABLE mytbl2
    GO
    USE pubs
    GO
    CREATE TABLE mytbl2
    (
     c1 sysname
    )
    GO
    INSERT mytbl2 VALUES ('Discount is 10-15% off')
    INSERT mytbl2 VALUES ('Discount is .10-.15 off')
    GO
    SELECT c1 
    FROM mytbl2
    WHERE c1 LIKE '%10-15!% off%' ESCAPE '!'
    GO
      

  4.   

    可以写:
    where username like 'wyb!_%' ESCAPE '!'
      

  5.   

    myyanghua(水手) 真是高手!
    OK!
      

  6.   

    Thank you!
    今天只回答一个问题,
    Bye.
      

  7.   

    不够500分,再来这个贴子里领剩下的吧!:)
    http://www.csdn.net/expert/topic/408/408385.shtm
      

  8.   

    '_'替换任意一个字符(必须有字符)
    '%'替换任意字符串
    ESCAPE 当字符串中本来包括'_'、'%'时使用
      

  9.   

    用[]括起来不就行了?
    select * from user where username like 'wyb[_]%'
      

  10.   

    myyanghua(水手) 
    不够500分,再来这个贴子里领剩下的吧!:)
    http://www.csdn.net/expert/topic/408/408385.shtm