2

I've looked and seen that calling a Microsoft SQL Server Stored Procedure with parameters using R is not possible. I am pretty sure that C++ can do that though, so would it be possible to use Rcpp to pass the parameters, make the call, and then return the recordset to R? Right now I'm using VBA which of course can interface just fine, but would rather find a way to use R.

sstan
  • 35,425
  • 6
  • 48
  • 66
Tyler Beason
  • 193
  • 1
  • 2
  • 9
  • You assume that there a library offering you a C++ interface to SQL server. There may not be one... – Dirk Eddelbuettel Jan 29 '15 at 05:51
  • @DirkEddelbuettel Well, isn't there? See [this related SQL and C++ question](http://stackoverflow.com/questions/15588485/sql-server-2012-via-native-c-no-atl-preferred-access-method-from-windows) – Tyler Beason Jan 29 '15 at 06:12
  • See the Rcpp FAQ -- you need to use MinGW and those libraries may not work. – Dirk Eddelbuettel Jan 29 '15 at 06:13
  • @TylerBeason I've used [cppdb](http://cppcms.com/sql/cppdb/) a little bit in the past, you might be able to work something out with this library. – nrussell Jan 29 '15 at 17:07
  • Also, the answer in [this question](http://stackoverflow.com/questions/8450832/getting-sql-stored-procedure-results-into-data-frame-format-using-rodbc) suggests that adding `set nocount on` to your SQL statement allows you to do this. – nrussell Jan 29 '15 at 18:45
  • Thanks for the help, I'll take a look. This isn't a high priority issue for me right now, but I do think the community would benefit if something like this was made available. – Tyler Beason Jan 29 '15 at 20:49

0 Answers0