From: morne dot olderwagen at lexisnexis dot co dot za
Operating system: windows 2003 server
PHP version: 5.2.5
PHP Bug Type: MSSQL related
Bug description: Stored proc query fails on NULL input
Description:
------------
I have a Stored Procedure that returns 4 result sets. The proc selects
data and inserts into a temp table and then reads back, etc. The temp table
is set up to allow null values, but I get this:
PHP Warning: mssql_query() [function.mssql-query]: message: Cannot insert
the value NULL into column 'PhysAddressLine2', table
'tempdb.dbo.#TempRandom_____________________000000000003'; column does not
allow nulls. INSERT fails. (severity 16) in ...
I have tested the proc in MSSQL Query Analyser and also tested the script
in ASP.NET, both worked fine.
Reproduce code:
---------------
$sql = "exec sp_dosearch 0,2,7,2,5";
if($qsql = mssql_query($sql, $link)) {
echo "<h3>OK</h3>";
/*do {
while($row = mssql_fetch_row($qsql)) {
}
} while (mssql_next_result($qsql)); */
} else {
echo"<h3>OWNED</h3>";
}
/* also tried */
$query = mssql_init("sp_dosearch", $link);
$SortOrder = 0;
$PASelectType = 2;
$PASelectID = 7;
$GeoSelectType = 2;
$GeoSelectID = 5;
mssql_bind($query, "@SortOrder", $SortOrder, SQLINT2);
mssql_bind($query, "@PASelectType", $PASelectType, SQLINT2);
mssql_bind($query, "@PASelectID", $PASelectID, SQLINT2);
mssql_bind($query, "@GeoSelectType", $GeoSelectType, SQLINT2);
mssql_bind($query, "@GeoSelectID", $GeoSelectID, SQLINT2);
if($res = mssql_execute($query)) {
echo "OK";
} else {
echo "OWNED";
}
Expected result:
----------------
OK
Actual result:
--------------
OWNED
--
Edit bug report at http://bugs.php.net/?id=44049&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=44049&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44049&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44049&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44049&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44049&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44049&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44049&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44049&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44049&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44049&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44049&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44049&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44049&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44049&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=44049&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=44049&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44049&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44049&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44049&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44049&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44049&r=mysqlcfg