Magic tables in SQL

Magic tables are nothing but the logical tables or temporary objects maintained by SQL server internally. Holds recently inserted values in the case of insert. Holds recently deleted values in the case of delete. Holds before updating values or after updating values in the case of update. We cannot see or access these tables directly, … Continue reading Magic tables in SQL


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