I recently read a SQL code snippet which confuses me.
declare @test nvarchar(100) = NULL
select
case
when @test <> '' then 1
else 0
end
I was quite confident that the result will be 1, since I think NULL is not equivalent to an empty string. However, the actual output is 0.
(I'm using MS SQL Server 2012 on Windows 7 64-bit)
As far as I understand, '' is an empty string which indicates the value contains 0 character, and Null means the data is in absence. But now I'm not sure about this. Can anyone help me to sort it out? Is this some exemption case?
''is like getting the rsvp slip back with nothing on it.nullis getting nothing back at all.<>to=and at least realized that something odd was happening here.