6

以下の結果が得られる理由を理解できません。

declare @myVar1 varchar = 'Friday'
declare @myVar2 varchar(10) = 'Friday'

select 
  case when @myVar1 = 'Friday' then 'yes' else 'no' end as test1,
  case when @myVar2 = 'Friday' then 'yes' else 'no' end as test2,
  case when @myVar1 = @myVar2 then 'yes' else 'no' end as test3

私が得るものは次のとおりです。

test1: no 
test2: yes 
test3: no

(オプションの) サイズなしで varchar が宣言されている場合、文字列比較が失敗するのはなぜですか?

4

1 に答える 1