Thursday, September 29, 2016

Querying a SQL Server Database in SSMS 2016 using R - 1

I described in an earlier post how to query a SQL Server Database using the ODBC DSN which uses the RODBC package.

After the integration of R with SQL Server 2016, it is possible to query a SQL Server database from within SQL Server Management Studio. However at present there are limitations for certain types of data such as XML.

In order to use R in SQL Server Management Studio make sure;
  • The server has started and you can connect to it
  • The Launch Pad service has started as shown:
QueryWithR_00.png

If this service has not started you get the MSG 39011 message as shown.


QueryWithR_01

After launching Launch Pad Service the query runs as shown.


QueryWithR_02

The result is to be understood as result set containing 29 rows and seven columns. It has returned informational message.

If you specify the columns your message will have information about those columns only.


QueryWithR_03

This query shows what data types have no support.


QuerywithR_04