Switch to the Czech version

Thursday, 30 August 2012

Database WTF

My 2 NULL WTF moments for today:

1. MSSQL is a twisted kind of database. It likes making things difficult for us developers. When you have a column with a NULL value, you would expect to get the value as a null of some sort (more specific - programming language null constant). But the result is an empty string...WTF?
How will I know whether it is a NULL or an empty string in that column? ... I have to what? Use some ISNULL functions and stuff? For something simple as that? Well that seems pretty weird.

2. MySQL is only a bit better. It turns out when you insert a single row with a NULL value into a column that is not supposed to be NULL, it fails with an error. This would be expected. But when you try to insert two or more rows in a single INSERT statement, the NULL changes to 0 and no error occurs. WTF?

I hope this is all for today...

No comments:

Post a Comment