Long SharePoint database names causing 'USE ?; EXEC sp_spaceused' to abort
EXEC sp_MSforeachdb 'USE ?; EXEC sp_spaceused' In using one variation of the above code, I ran into a problem reporting the sizes of Microsoft SharePoint databases because the name of at least one of the databases is being truncated in the sp_MSforeachdb code somewhere, which causes the procedure to abort. Has anyone mentioned a solution to this before? I looked but didn't find one. My plan was to use the above to store database space used information in a table for ultimate reporting purposes. Thank you. Barbara
try this: EXEC sp_MSForEachDB 'USE [?]; EXEC sp_spaceused' Chances are your database names have "dodgy" characters in their names - wrapping the name in square brackets will protect against it. By "dodgy" I mean hyphens (or minus signs), spaces - that sort of thing.