T-SQL Tutorial

T-SQL Sp_tables


On Transact SQL language the sp_tables is part of Catalog Stored Procedures and return a list of objects (table or view) that can be queried in the current environment.

Sp_tables syntax:

sp_tables [ @table_name = 'Table name.' ] ,
[ @table_owner = 'The database user who created the table.' ] ,
[ @table_qualifier = 'Database name.' ] ,
[ @table_type = "Table, system table, or view." ] ;





Sp_tables example 1:

USE model;
GO
EXEC sp_tables ;
GO

Sp_tables example 2:

USE model;
GO
EXEC sp_tables
@table_name = '%',
@table_owner = 'dbo',
@table_qualifier = 'model';
GO