MS-SQL

'' = 0 ???!!!!

김뽀씨 2024. 11. 11. 11:56

빈 문자열 ''은 SQL Server에서 숫자 0과 같다고 간주되기 때문에 isnull(@a, 0)의 결과가 0과 비교되었을 때 참이 됩니다.

 

declare @a varchar(100)
set @a = ''


if isnull(@a,0) = 0
begin
select 1
end

;;;;;;;;;;;;;;;