4 ms·
The document you link uses unknown as a synonym for null. If you inserted the result of such a comparison into a table, the value inserted would be NULL.
by bfgoodrich 4y ago
The document you link uses unknown as a synonym for null. If you inserted the result of such a comparison into a table, the value inserted would be NULL.
- magicalhippo 4y agoI'm self-taught, could you show how to insert the result of such a comparison into a table in mssql? I can only think of using CASE or similar, which would mean no direct conversion.
- orf 4y agoinsert into table (c) values (null != null)
- magicalhippo 4y agoCan you provide a complete working example? I'm just getting "incorrect syntax near !" with both mssql and sqlanywhere. create table #nulltest (a bit null); insert into #nulltest(a) values (0),(1); insert into #nulltest(a) values (null != null);
- distalzou 4y agoSome SQL dialects don't recognize != and use <> instead
- magicalhippo 4y agoTrue, I'll blame vacation mode for not catching that one. However, that doesn't change things, I can't get any of these to parse: insert into #nulltest(a) values (1 <> 0); insert into #nulltest(a) values (null <> null); insert into #nulltest(a) values (true and true); insert into #nulltest(a) values (null and null); So my question remains, how do you insert an UNKNOWN? The point of me asking is that it was my belief contrary to what was suggested, UNKNOWN is not the same as NULL and, crucially, does not evaluate as NULL.
- bfgoodrich 4y ago
- deleted 4y ago[deleted]
- ratsmack 4y agoIt's good to see that everyone agrees on the definition of NULL.
- DaiPlusPlus 4y agoYes: a billion-dollar mistake.
- bazoom42 4y agoThis is s misunderstandig of Hoares “billion dollar mistake”. The mistake was not the existence of nulls, the mistake was type systems where every reference could be null. Sql does not have this problem.
- deleted 4y ago[deleted]
- lmm 4y agoSQL absolutely does have that problem. You have no way of enforcing or checking that an expression is supposed to be non-NULL; at best you get an error at runtime when you try to insert it into a given column, which is usually far too late.
- erichocean 4y agoAnd with RDBMSs, a multi-trillion dollar success!