note 24857 added to function.mssql-connect

From: Date: Fri, 30 Aug 2002 11:39:33 +0000
Subject: note 24857 added to function.mssql-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-36033@lists.php.net to get a copy of this message
A bit obscure, this one, but maybe it will save someone else the hair loss I experienced... PHP 4.2.2 under IIS on Win2K, MSSQL Server 2000, SP2. There is a subtle difference in the way PHP connects to MSSQL when running under Windows to the way it connects when running through FreeTDS. When the connection is made, a number of 'SET' statements are issued that affect the way nulls are handled, whether transactions are implicit, etc. You can see these by using the SQL Server Profiler tool to look at the login. If you use a stored procedure to create a temp table, you may get errors complaining that you cannot insert null values into the table. The same sp will run fine in Query Analyser, or through a FreeTDS connection. To fix the problem, open Enterprise Manager, right click on the server > Properties > Connections. Make sure 'ANSI null defined on' is checked. You can also play with some of the other settings there. Of course more rigorous table defs solve the problem too, but who's got time for that ;^) If anyone knows a way to change the 'SET' statements issued at login from PHP, I'd be very interested to hear. -- http://www.php.net/manual/en/function.mssql-connect.php http://master.php.net/manage/user-notes.php?action=edit+24857 http://master.php.net/manage/user-notes.php?action=delete+24857 http://master.php.net/manage/user-notes.php?action=reject+24857

« previous php.notes (#36033) next »