﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Gaby Abed  / Monitor file growth - a better way for sp_spaceused / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 21 Mar 2010 22:51:01 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Monitor file growth - a better way for sp_spaceused</title><link>http://www.sqlservercentral.com/Forums/Topic564989-1373-1.aspx</link><description>Sorry about the late reply, was swamped at work. :)One way to do it for each database is either the undocumented sp_msforeachdb feature or roll it into a loop. You can use cursors but I personally don't use them much.  Here is a non-cursor version:[code]declare @db_list table (dbname sysname)declare @dbname sysname, @query varchar(8000)insert @db_list(dbname)  select name from sys.databases  where name not in ('tempdb', 'master', 'msdb', 'model')  -- feel free to change as needed  order by name ascwhile (select count(*) from @db_list) &amp;gt; 0   -- one way to iterate, the list is small enough that this will have no impactbegin  select top 1 @dbname = dbname from @db_list  select @query = 'use ' + quotename(@dbname) + '; INSERT THE NEW SP_SPACEUSED SCRIPT HERE'  exec(@query)  delete from @db_list where dbname = @dbnameend[/code]Hope this helps and good luck.Gaby A.Toronto, ON</description><pubDate>Wed, 22 Oct 2008 07:25:40 GMT</pubDate><dc:creator>GabyYYZ</dc:creator></item><item><title>RE: Monitor file growth - a better way for sp_spaceused</title><link>http://www.sqlservercentral.com/Forums/Topic564989-1373-1.aspx</link><description>Looks good but how do you go about getting the same information for all databases on a SQL instance.i.e I'm trying to check when a database is about to auto-extend and I just want the available space for DB1, DB2 etc.The USE command doesnt seem to permit the constructUSE @dbName. You have to implicitly specify the database i.e USE "DB1"KRIan</description><pubDate>Mon, 13 Oct 2008 04:23:33 GMT</pubDate><dc:creator>Ian Molyneaux</dc:creator></item><item><title>Monitor file growth - a better way for sp_spaceused</title><link>http://www.sqlservercentral.com/Forums/Topic564989-1373-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/sp_spaceused/64271/"&gt;Monitor file growth - a better way for sp_spaceused&lt;/A&gt;[/B]</description><pubDate>Fri, 05 Sep 2008 23:56:07 GMT</pubDate><dc:creator>GabyYYZ</dc:creator></item></channel></rss>