Clear Database Tuning Advisor Tables

When using the SQL Server Database Tuning Advisor (DTA) the UI can get clustered with all the completed sessions. You could right-click each session and delete them. Or, you could just run this SQL:

USE msdb
GO

-- -------------------------------------------------------------------------------
-- Clear Database Tuning Advisor Tables
-- -------------------------------------------------------------------------------

TRUNCATE TABLE DTA_output;
TRUNCATE TABLE DTA_progress;
TRUNCATE TABLE DTA_reports_indexcolumn;
TRUNCATE TABLE DTA_reports_partitionscheme;
TRUNCATE TABLE DTA_reports_querycolumn;
TRUNCATE TABLE DTA_reports_querydatabase;
TRUNCATE TABLE DTA_reports_queryindex;
TRUNCATE TABLE DTA_reports_querytable;
TRUNCATE TABLE DTA_reports_tableview;
TRUNCATE TABLE DTA_tuninglog;
GO

DELETE FROM DTA_reports_table;
DELETE FROM DTA_reports_partitionfunction;
DELETE FROM DTA_reports_database;
DELETE FROM DTA_reports_column;
DELETE FROM DTA_reports_index;
DELETE FROM DTA_input;
DELETE FROM DTA_reports_query;
GO