I am having trouble understanding why I am getting the results below:
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
I get:
test1: no test2: yes test3: no
Why is string comparison performed if varchar is declared without (optional) size?
Geoff source share