ODBC Functions & MS SQL Server 2005

From: Date: Thu, 18 Sep 2008 13:20:31 +0000
Subject: ODBC Functions & MS SQL Server 2005
Groups: php.general 
Request: Send a blank email to php-general+get-280434@lists.php.net to get a copy of this message
Hi, Anyone else using the odbc_* functions to interact with MS SQL Server 2005? I'm having a problem getting odbc_num_rows() to return anything other than -1 when querying a stored procedure. I can get it to work using Top in a normal query (non-stored procedure). SELECT Top 1000000 * FROM Table if I do an odbc_num_rows( result ) on that, I get the number of rows. However... EXEC ProcedureName @Var = 'value' if I do an odbc_num_rows( result), I get -1. The same is true if I did a straight SELECT * FROM Table. I've tried putting Top in my query in the stored procedure. Right now I'm either doing an extra query for @@ROWCOUNT, or I'm doing two result sets, a counting query, and then the normal query. I am concerned about performance in doing the two queries, and with @@ROWCOUNT, I feel I'm just adding extra things to the code that may be unreliable? From what I've read, its something with the ODBC driver, and updating the ODBC driver isn't an option. Anyone else having this problem? Any suggestions? -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. "Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life."

« previous php.general (#280434) next »