I recently find out that the check I am using for empty string is not working for some of the data. I am using:
[DataField] <> ''
And for some characters it seems to not work:
For example, the following yields 1:
SELECT IIF(N'' = '', 1, 0);
It seems, that the ASCII code for all of this is 63:
SELECT ASCII(N'');
SELECT ASCII(N'');
SELECT ASCII(N'');
SELECT ASCII(N'');
SELECT ASCII(N'');
SELECT ASCII(N'☕');
In the table it is ?.
If I use, CHAR(63) the check is working:
SELECT IIF(CHAR(63) <> '', 1, 0); -- 1
SELECT IIF(N'' <> '', 1, 0); -- 0
Of course, I just change the check to be LEN([DataField]) > 0 and now everything is fine. Just wondering, can anyone explain, why the initial check fails?
