FYI :: MSSQL and stored procedures

From: Date: Tue, 09 Jul 2002 01:16:35 +0000
Subject: FYI :: MSSQL and stored procedures
Groups: php.db 
Request: Send a blank email to php-db+get-20407@lists.php.net to get a copy of this message
Just throwing this out there in case someone has come across this before and hasn't found a solution: If you are performing a stored procedure inside a loop, it is a good idea to unset the variable that mssql_init returns so that you do NOT bind multiple values to the same stored procedure: foreach($input as $sid=>$value) { $stmt = mssql_init("sp_doSomething"); mssql_bind($stmt, "@sid", $sid, SQLINT4, false); mssql_bind($stmt, "@value", $value, SQLINT4, false); $result = mssql_execute($stmt); unset($stmt); // <---VERY important } Even doing the mssql_init outside the loop does not help because of the multiple binds happening inside the loop. Failing to do the above generates "Access Violations...memory cannot be 'written'" errors on the server. My hypothesis is that the error is generated when you try to bind to a stored procedure after it has already been executed. You have been warned.

« previous php.db (#20407) next »