Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderatorhttp://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.

I have adapted the script and it works great. Thanks. But if your databases contains some "weird characters", eg "-" or "&", it will fail. To fix it, put in a pair of square brackets "[ ]" in front and behind the keyword "use".

I have adapted the script and it works great. Thanks. But if your databases contains some "weird characters", eg "-" or "&", it will fail. To fix it, put in a pair of square brackets "[ ]" in front and behind the keyword "use".