devxlogo

Transact-sql

Identifying Unused Tables with T-SQL

You can identify unused Tables in the following way: ; with Unused (TableName , RowCount, DateCreated, DateModified)AS (SELECT unusedTable.name AS TableName,PS.row_count AS RowCount,unusedTable.create_date AS DateCreated,unusedTable.modify_date AS DateModifiedFROM sys.all_objects UnusedTableJOIN sys.dm_db_partition_stats

Using TRY and CATCH Blocks in T-SQL

You can handle errors in T-SQL almost the same way as in C# or Visual Basic. You can make use of a Try and catch block to trap errors and