Source for lots of TSQL:

http://ola.hallengren.com