• The newest version of Red Gate's SQL Prompt will do that for you and lots more. Also Red Gate's SQL Refactor has a way to clean up the layout of code. If nothing else, here's a quick, free, utility to do the same:

    http://www.simple-talk.com/sql/sql-tools/the-simple-talk-sql-prettifier/[/url]

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning