Laurent Vaills wrote: > When I run this query : > SELECT * FROM Test WHERE Text = NULL; > I got 0 rows but if I run this query : > SELECT * FROM Test WHERE Test IS NULL > I got 1 row. > (Same for <> NULL and IS NOT NULL). > > Is it a bug or not ? If not, should the user be warned that he can't use > the operator = or <> with NULL .
This is just the way SQL is defined: from http://www.networkcomputing.com/netdesign/1213sql22.html So while an empty value is the same as another empty value, a NULL is not the same as another NULL value, because NULL means 'unknown value'; two unknown values will not necessarily be the same! Keep this definition in mind during all of the SQL queries that we write. NULL values are special and are treated differently from other values. The WHERE clause has a special condition just for NULL values: IS NULL. Daniel Dittmar -- Daniel Dittmar SAP DB, SAP Labs Berlin [EMAIL PROTECTED] http://www.sapdb.org _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
