Monday, February 20, 2012

Problems when running a stored procedure using a cursor via ODBC

Hello All,
This is an interesting one... I have a stored procedure on a
sql-server 2000. The procedure opens a cursor and then perform some
operations on a certain table.
When I run the procedure from a "sql query analyzer" window it works
fine, the cursor steps over all the necessary rows in the table but
when I run the procedure via ODBC (a tcl-script using "tclodbc") the
cursor behaves differently. It seems that the select used when opening
the cursor does not return all the necessary rows.
Are there any known issues when running a stored procedure via an ODBC
connection?
It is not a "user rights" problem.
Sincerely,
Tobias AI'm not familiar with TCLODBC but maybe it's a problem specific to that
product. My suggestion is that you try to rewrite your code without a
cursor. Cursors are rarely necessary and almost always an inefficient
solution. Maybe if you stick to standard SQL there's a better chance that
your code will be correctly supported by TCLODBC.
--
David Portas
SQL Server MVP
--

No comments:

Post a Comment