4

Is there a function in the DBI package to get information about the schema of a database?

I am working with a connection to an SQL Server with the DBI package and the odbc driver. The dbListTables functions allows to show the tables in a particular schema with the schema parameter, but I cannot find a way to query which schemas there are.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

6

You could use the SQL query below.

all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
qfazille
  • 1,643
  • 13
  • 27