Home Forums SQL Server 2005 Administering QUERY: GET SPACE USED/FREE in All Databases RE: QUERY: GET SPACE USED/FREE in All Databases<!-- 864 -->

  • MJ,

    The DBCC command showfilestats returns the logical name and the physical name of the files associated to the current database. If you have verbose names, as in a sharepoint installation, there are 2 problems with the code.

    1. The USE ? command needs to have brackets because of database names that have dashes in them.

    2. The db column in your table variable should be renamed to logical file name and increased in size. I would recommend using the sysname type.

    Otherwise, this is a fine bit of code. Thank you for the tip.

    Your Friendly Neighborhood DBA,

    Chuck