|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-07 05:32 UTC] jasonh at trurocollege dot ac dot uk
The MSSQL extension fails to even open (using mssql_query) a query on a stored procedure that uses a cursor on a query containing an expression. The following SP works fine in Query Analyser (MSSQL7) but will not get past the mssql_query line in PHP. The occurrence of the expression "id + 1" is, bizarrely, the apparent cause of the problem. Changing this to just "id" makes it all work from PHP. ------------ CREATE PROCEDURE TestCursor AS --This makes no difference: -- set nocount on declare c scroll cursor for select id + 1 as newid from table open c fetch next from c while (@@fetch_status = 0) fetch next from c close c deallocate c -- set nocount off PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
I have the same problem. I am using PHP statement mssql_query( "EXEC db_sequence 1, 2, 3, 1" ) {query B} to call stored procedure on MSSQL 2000 server, which produces output using cursor. Different is (against Jasons prob), that I use global cursor defined using mssql_query( "DECLARE rowset CURSOR GLOBAL SCROLL FOR $query" ) {query A} because I need dynamically choose executed query. Statement {A} creates global cursor which is fetched and dropped in SP db_sequence {B}. When I uses as $query SQL command 'SELECT id FROM store', it works fine. But if I use something like 'SELECT id+1 AS col FROM store', PHP crashes. Both sequences of SQL queries run without problems in SQL Query Analyzer (SQL 2k). I found this problem on PHP version 4.2.0 for win32. I try latest version of PHP from http://snaps.php.net/win32/ (both, stable v4.2.2-dev and unstable v4.3.0-dev) but problem persists. I'm using Apache 1.3.20/PHP 4.2.0 on Win2k advanced server. Can you tell me, what is wrong?