(TIL) TSQL: Basic T-SQL

less than 1 minute read

-- Show all databases.
select name from master.sys.databases;

-- Show all tables.
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'

-- Show all tables from a particular database.

SELECT TABLE_NAME FROM <DATABASE_NAME>.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'

Comments