OK, to answer my own question...

The ansi_* settings were to blame for the sp failing. In Enterprise Manager
I went into the Server Properties (Properties > Connections) and made sure
'ANSI null defined on' was checked and the problem has cleared up.

Still mystified, though: why do connections from Query Analyser and FreeTDS
set these things up properly, and connections from Win PHP not? And is there
a way to change the connection setting from within PHP?

Matt


> -----Original Message-----
> From: Matt Kynaston [mailto:[EMAIL PROTECTED]]
> Sent: 30 August 2002 10:31
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] MSSQL trouble: ansi_nulls?
>
>
> Hi there,
>
> I tried posting this to the newsgroup yesterday, but it
> doesn't look like it
> worked - sorry if it shows up twice.
>
> I'm running PHP 4.2.2 under Win2K/IIS and trying to run a
> stored proc in
> MSSQL2000 (SP2) on the same server.
>
> Exactly the same script works fine from Linux/Apache using
> FreeTDS, but
> won't work from the Win2K.
>
> I can connect (verified from Profiler), but the mssql_query()
> returns the
> following error:
> Warning: MS SQL message: Cannot insert the value NULL into
> column 'height',
> table
> 'tempdb.dbo.#LimitTable_______________________________________
> ______________
> ____________________________________________________0001000000
> 14'; column
> does not allow nulls. INSERT fails. (severity 16) in
> e:\Inetpub\wwwroot\canaryislands-golf.com\common\classes\etbsq
> ltemplate.inc
> on line 42.
>
> The same stored proc runs fine from Query Analyser. I've
> noticed a couple of
> strange things using Profiler. When the Linux box connects (or Query
> Analyser), it issues the following statements:
>
> -- network protocol: TCP/IP
> set quoted_identifier on
> set implicit_transactions off
> set cursor_close_on_commit off
> set ansi_warnings on
> set ansi_padding on
> set ansi_nulls on
> set concat_null_yields_null on
> set language us_english
> set dateformat mdy
> set datefirst 7
>
> The PHP connection differs, and I think that's what's causing
> the problems:
>
> -- network protocol: TCP/IP
> set quoted_identifier off
> set implicit_transactions off
> set cursor_close_on_commit off
> set ansi_warnings off
> set ansi_padding off
> set ansi_nulls off
> set concat_null_yields_null off
> set language us_english
> set dateformat mdy
> set datefirst 7
>
> Does anyone know how to change the ansi_* and
> concat_null_yields_null set
> statements that are issued when PHP connects? Or am I on the
> wrong track?
>
> Regards,
>
> Matt
>

Reply via email to