Create a maintenance plan. In Object Explorer, connect to an instance of Database Engine. On the Standard bar, select New Query. Copy and paste the following example into the query window and select Execute. In this example, the code creates a daily SQL Agent job that runs at 23:30 (11:30 p.m.), which reorganizes all the indexes on the ...