Hi there,
I've got a very strange sql-related problem.
I'm accessing a MSSQL Server 2005 with PHP (odbc), when I profile the sql statement the following is executed:
declare @p1 int
set @p1=180150003
declare @p3 int
set @p3=2
declare @p4 int
set @p4=1
declare @p5 int
set @p5=-1
exec sp_cursoropen @p1 output,N'SELECT fieldA, fieldB, fieldC, fieldD, fieldE FROM mytable WHERE fieldB IS NULL',@p3 output,@p4 output,@p5 output
select @p1, @p3, @p4, @p5
exec sp_cursorfetch 180150003,2,1,1
On my own server it's working fine, on the customer-server the sp_cursorfetch reads infinite rows and loads the full cpu. When I try to execute the statement itself
SELECT fieldA, fieldB, fieldC, fieldD, fieldE FROM mytable WHERE fieldB IS NULL
in SQL Server Management Studio it works fine (under 1sec).
Any ideas?
Edit: the main difference between the servers is that my server is a x86 (Win2003) and the server of the customer is a x64 (Win2008).
Edit2: Added Where-Clause