1、不是,应为你是varchar类型,如果char就会2、select *  from notebook where publishment='清华大学出版社'

解决方案 »

  1.   

    如果你的表里已经有空格了:select *  from notebook where rtrim(publishment)='清华大学出版社'-------------------------------------
    RTRIM
    截断所有尾随空格后返回一个字符串。语法
    RTRIM ( character_expression ) 参数
    character_expression由字符数据组成的表达式。character_expression 可以是常量、变量,也可以是字符或二进制数据的列。返回类型
    varchar注释
    character_expression 必须为可隐性转换为 varchar 的数据类型。否则请使用 CAST 函数显式转换 character_expression。说明  兼容级别可能影响返回值。有关更多信息,请参见 sp_dbcmptlevel。 
    示例
    下例显示如何使用 RTRIM 删除字符变量中的尾随空格。DECLARE @string_to_trim varchar(60)
    SET @string_to_trim = 'Four spaces are after the period in this sentence.    '
    SELECT 'Here is the string without the leading spaces: ' + CHAR(13) +
       RTRIM(@string_to_trim)
    GO下面是结果集:(1 row(s) affected)
    ------------------------------------------------------------------------ 
    Here is the string without the leading spaces: Four spaces are after the period in this sentence.           
    (1 row(s) affected)
      

  2.   

    你~你~ 回复好快
    第一个问题我明白了
    问题是第二个,我是用delphi写程序 输入的查询条件是在edit框中,就是edit.text,这样在edit框中
    输入字符 清华大学出版社~后面有没有空格尾巴呢?应该怎么精确查询呢
    select * from notebook where piblishment  ???? edit.text
      

  3.   

    DELPHI沒用過,以下是VB的語法
    strsql="select * from notebook where piblishment ='" &  edit.text & "'"
      

  4.   

    format('select * from 表名   where 列名 = ''%s''',[edit.asstring])
      --table_edit是对应的数据库里的字段
      

  5.   

    可是edit没有asstring字段啊~编译通不过
      

  6.   

    啊啊阿~感谢 chenjie_0706(陈洁) 只有把asstring 变成 text就搞定了!
    超级谢