Information_schema.tables : Information_schema « System Settings « SQL Server / T-SQL Tutorial






The Information_schema. tables view contains one row for each table in the current database to which the user has access.
13>
14> select top 10 * from Information_schema.tables;
15> GO
TABLE_CATALOG                                                                                                                    TABLE_SCHEMA
                                                          TABLE_NAME                                                                                                                       VIEW_DEFINITI
ON


















                                                                                                                                                                                            CHECK_OPTION
 IS_UPDATABLE
-------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------
--------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------
 ------------

(0 rows affected)
TABLE_CATALOG                                                                                                                    TABLE_SCHEMA
                                                          TABLE_NAME                                                                                                                       TABLE_TYPE
-------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------
--------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----------
master                                                                                                                           dbo
                                                          spt_fallback_db                                                                                                                  BASE TABLE
master                                                                                                                           dbo
                                                          spt_fallback_dev                                                                                                                 BASE TABLE
master                                                                                                                           dbo
                                                          spt_fallback_usg                                                                                                                 BASE TABLE
master                                                                                                                           dbo
                                                          airplane                                                                                                                         BASE TABLE
master                                                                                                                           dbo
                                                          spt_monitor                                                                                                                      BASE TABLE
master                                                                                                                           dbo
                                                          spt_values                                                                                                                       BASE TABLE
master                                                                                                                           dbo
                                                          MSreplication_options                                                                                                            BASE TABLE

(7 rows affected)
1>








26.14.Information_schema
26.14.1.select top 10 * from Information_schema.columns
26.14.2.Information_schema.views
26.14.3.Information_schema.tables
26.14.4.System views INFORMATION_SCHEMA
26.14.5.obtain metadata about database objects.
26.14.6.SELECT TABLE_CATALOG FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'TestTable'
26.14.7.Match a table name in tempdb.INFORMATION_SCHEMA.TABLES
26.14.8.Query tempdb.INFORMATION_SCHEMA.TABLES
26.14.9.A script that creates a summary of the tables in a database
26.14.10.Check the view existance