Quick Queries for SQL

/************************** Check list of tables in DB ****************************/ SELECT '['+TABLE_SCHEMA+'].['+TABLE_NAME+']' FROM <DB_Name>.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_SCHEMA GO /******************************* Check Table and SP *********************************/ SP_HELP 'DBO.TableName' -- Table_Name GO SP_HELPTEXT 'DBO.SPName' -- SP_Name GO SP_HELPDB DBName -- DB_Name GO SP_SPACEUSED -- Total free space including Transaction log free space GO DBCC SQLPERF(logspace) … Continue reading Quick Queries for SQL

Advertisements