• Edit: DOH, I didn't see this thread was quite old, for some reason it came up in my feed on the site home page. Oh well, still relevant certainly!

    Hi there, I actually just published an article describing exactly how to do this, with a stored procedure that wraps up all the necessary logic.

    http://www.sqlservercentral.com/articles/Maintenance+and+Management/131604/[/url]

    Let me know if this works for you or if you can think of anything that would make it better!