• Useful, thanks!

    One minor point: you've declared ObjectType as char(1), but it should be char(2) to match the xtype field in sysobjects. Functions have xtype='FN', so cause the batch to fail.

    Bryan.