SQL Server Metadata


SQL Server Metadata


INFORMATION_SCHEMA Queries

The information schema is a method SQL Server provides for obtaining metadata. You can query this schema to view SQL Server metadata, including lists of tables, columns, etc. on your linked SQL server. “INFORMATION_SCHEMA” is the schema name used in SQL queries.

Below are examples of information schema queries:

Table Query

This query returns a list of tables in use on your linked server.

 SELECT * FROM CData2.cdata.INFORMATION_SCHEMA.tables

Columns Query

This query returns metadata information about the columns/fields in your Account table:

  SELECT * FROM CData2.cdata.INFORMATION_SCHEMA.Columns WHERE Table_name='Account'

You can filter this by table name.

Referential Constraints Query

This query returns metadata information about the foreign key constraints in your Salesforce tables:

   SELECT * FROM CData2.cdata.INFORMATION_SCHEMA.Referential_Constraints 

Documentation

For more about the Information Schema, see System Information Schema Views in the Microsoft documentation.