本来就相等:你自己看看
if  'A'='A  '
raiserror('==',12,1)
else
raiserror('<>',12,1)

解决方案 »

  1.   

    默认情况下,'A' 与'A  '本身是相等的,因为SQL自身会取掉后面的空格再作比较
    如:
    if 'A'='A '
      print '0'
    else
      print '1'
    结果:0
      

  2.   

    select 'a'=left('a    ',1)相等
      

  3.   

    --测试
    declare @表 table(a varchar(10),b nvarchar(10),c char(10),d nchar(10))
    insert @表
    select 'A ','A','A','A'
    union all select 'A','A ','A','A'
    union all select 'A','A','A ','A'
    union all select 'A','A','A','A '--查询
    select * from @表 where a='A'
    select * from @表 where b='A'
    select * from @表 where c='A'
    select * from @表 where d='A'/*--测试结果
    a          b          c          d          
    ---------- ---------- ---------- ---------- 
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         (所影响的行数为 4 行)a          b          c          d          
    ---------- ---------- ---------- ---------- 
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         (所影响的行数为 4 行)a          b          c          d          
    ---------- ---------- ---------- ---------- 
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         (所影响的行数为 4 行)a          b          c          d          
    ---------- ---------- ---------- ---------- 
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         
    A          A          A          A         (所影响的行数为 4 行)--*/
      

  4.   

    pbsql(风云) :终于把你的楼上战回来一次,不然次次输给你:)