我无法理解为什么会得到以下结果:
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 时没有(可选)大小,为什么字符串比较会失败?