[R] RODBC results from stored procedure

tradenet nodecorum at yahoo.com
Wed Jul 22 00:51:24 CEST 2009


Thanks Dieter.

The stored proc drops and recreates a result table that contains a copy of
the same result set that is returned by the query.

If I pause after line 1, line 2 returns a valid result set and line 4
displays a table of data.
If I do not pause the script after line 1 or 2, line 3 fails, saying
datatable does not exist (line 1 query has not completed the recreation of
datatable) and line 4 displays no data.

Also, the query in line one returns a single result set, a select statement
from datatable, but R doesn't see this returned result set after invocation
of only line 1. 


1.) dbdata<-sqlQuery(conn,"sp_GetData)  #returns a result set in query
analyzer, not in R
2.) head(dbdata) #it's empty
3.) dbdata<-sqlQuery(conn,"select * from datatable order by Date asc") 
4.) head(dbdata) #the data is in dbdata


My workaround is to run line 1's query manually before running any R
scripts.  Not ideal, but I'm at a loss for what else to try for this prickly
case.

Warm regards,

Andrew




Dieter Menne wrote:
> 
> 
> 
> tradenet wrote:
>> 
>> Thanks Dieter.
>> 
>> The date argument isn't a problem.  When I invoke the stored proc
>> execution with the date arguments the stored proc runs fine, but RODBC
>> doesn't wait for the stored proc to finish and return results.
>> 
>> 
> 
> Don't understand that one. How do you know that is did not wait to finish? 
> 
> Did the call I showed you work with the Northwind database?
> 
> Dieter
> 
> 

-- 
View this message in context: http://www.nabble.com/RODBC-results-from-stored-procedure-tp24503096p24597208.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list