Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timeout for long-running queries with RODBC & MS SQL Server

I have to run an SQL query that iterates cursor over a larger table (MS SQL Server 2014). It would be rather difficult not to use a cursor for this particular purpose.

The cursor-related code is kept in a stored procedure. R only evaluated EXEC dbo.do_something. EXEC dbo.do_something works as expected when running the code from MS SQL Management Studio. When I run it via RODBC, the query aborts without error message after 30 secs. I guess this is the value of "Connection Timeout".

What options do I have to make the query work with R?

like image 764
lith Avatar asked Apr 28 '26 01:04

lith


1 Answers

It seems the answer to my particular problem is rather simple: Add SET NOCOUNT ON to the proc definition.

like image 146
lith Avatar answered Apr 30 '26 15:04

lith