Skip to content
Advertisement

Extracting Data from SQL Server Table within a Schema

I am having a hard time writing and extracting data from SQL Server in RStudio. My database hierarchy is as follows:

  • LDS
    • LDS
      • HIG
        • table_needed

I’ve tried:

also

From what I’ve read, my problem is that my LDS Schema is set to default. Is there a way to default my LDS schema? If not, is there a certain code I can use?

Advertisement

Answer

Here’s what I typically do:

Then you can write your SQL as you normally would constructing the path to your schema as you would writing native SQL.

Then you could pass that to your connections with:

The other option is that you use dbplyr and do something like

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement