[R] Change database in SQL Server using RODBC
Peter Crowther
peter.crowther at melandra.com
Mon Jun 30 10:34:39 CEST 2014
On 30 June 2014 02:44, Ira Sharenow <irasharenow100 at yahoo.com> wrote:
> I wish to query tables that are NOT in the default SQL Server 2012 database.
> Now for the problem. I also want to read in the table dbo.sports. That
> table is in the database sportsDB. I did not see any way to do so from
> within R.
Can you not use sportsDB.dbo.sports to reference the table?
In general, table reference syntax is [ [ [ serverName '.' ]
databaseName '.' ] [schema ] '.' ] tableName, where the names need
only be surrounded by [...] if they are not valid SQL Server
identifiers. Many people may suggest you reference
[sportsDB].[dbo].[sports]; this is unnecessary verbiage.
Cheers,
- Peter
More information about the R-help
mailing list