|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-07 18:17 UTC] kalle@php.net
[2011-04-08 20:48 UTC] jani@php.net
-Package: Feature/Change Request
+Package: MSSQL related
[2011-12-01 05:20 UTC] ssufficool at gmail dot com
[2011-12-01 05:28 UTC] ssufficool@php.net
[2011-12-01 05:28 UTC] ssufficool@php.net
-Status: Open
+Status: Bogus
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 00:00:01 2025 UTC |
Description: ------------ When querying a MSSQL database table, and using the "not in" syntax, PHP's mssql_query will also return rows with NULL in the field specified. Reproduce code: --------------- SQL Server 2000 or 2005 Table "test" test_id (int) test_name (vchar) test_number (int) 1 Foo 1 2 Bar 2 3 <null> 3 4 Baz <null> $sql = "select test_id from test where test_number not in (1,2)"; $res = mssql_query($sql); while ($row = mssql_fetch_array($res)) { ?> <?=$row['test_id'];?><br/> <? } Expected result: ---------------- In PHP, either using FreeTDS on Linux or the MSSQL extension on Windows, the above returns: 3 4 In ASP/VBScript or using Query Analyzer on Windows the following is returned: 3 Windows' MSSQL driver apparently will not compare the "not in" values to a NULL field. PHP, apparently, will. This creates and inconsistency between the two platforms.