note 24857 rejected from function.mssql-connect by didou
| From: | didou@php.net | Date: | Fri, 30 May 2003 12:12:23 +0000 |
| Subject: | note 24857 rejected from function.mssql-connect by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49419@lists.php.net to get a copy of this message | ||
Note Submitter: kynaston@yahoo.com
----
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.