Wednesday, September 9, 2015

Useful SQL Server Scripts

List names of all tables in a SQL Server 2012 schema

For MySQL SHOW TABLES;
SELECT t.name 
  FROM sys.tables AS t
  INNER JOIN sys.schemas AS s
  ON t.[schema_id] = s.[schema_id]
  WHERE s.name = N'schema_name';
Use schema_name; 
Select * from Information_Schema.Tables
-- Where Table_Type = 'BASE TABLE' /*Filtered out View*/
Order by Table_Name;

No comments:

Post a Comment