Here’s a list of sql commands (T-SQL) to get the names of all tables, views, sprocs and triggers in SQL Server:
-- Get all Tables SELECT name FROM sys.tables -- Get all Views SELECT name FROM sys.views -- Get all Stored Procedures SELECT name FROM sys.procedures -- Get all Triggers SELECT name FROM sys.triggers
If you want to see all objects within the database, use the following SQL command:
SELECT name, type, type_desc FROM sys.objects
Try this one to also include all column names info:
SELECT * FROM sys.tables t INNER JOIN sys.columns c ON t.object_id = c.object_id
Further Reading
sys.objects (Transact-SQL)
How to Get Table Definition in SQL Server
How to Find All References to an Object in a SQL Server Database
How to Search for a String in All Tables in a Database
How to Find a String in SQL Server Stored Procedures
Leave a Reply