﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 Administration  / How to find allocated space and used space / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 04:18:48 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>There is a script here to help you with that.[url]http://jasonbrimhall.info/2012/07/17/a-trio-of-eachdb/[/url]</description><pubDate>Fri, 21 Dec 2012 01:26:31 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>Hello Team,I am using below query to get size_mb and unused space in databaseIs there any way to get instance level or report ?Query:select	a.FILEID,	[FILE_SIZE_MB] = 		convert(decimal(12,2),round(a.size/128.000,2)),	[SPACE_USED_MB] =		convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)),	[FREE_SPACE_MB] =		convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) ,	NAME = left(a.NAME,15),	FILENAME = left(a.FILENAME,30)from	dbo.sysfiles aResult---------Field id  FILE_SIZE_MB Space_used_mb free_space_mb        name           filename1	4.00	      2.94	                   1.06	                     master	C:\Program Files (x86)\Microso2	1.25	      0.64	                   0.61	                     mastlog	C:\Program Files (x86)\MicrosoKindly help me Thanks in advance</description><pubDate>Fri, 21 Dec 2012 01:13:02 GMT</pubDate><dc:creator>RK2012</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>For database log file space stats,you can run " dbcc sqlperf ".[code="sql"]dbcc sqlperf('LOGSPACE')[/code]</description><pubDate>Wed, 19 Dec 2012 21:43:42 GMT</pubDate><dc:creator>jyuan68</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>don't remove the whole thing, just remove the spaces.the string of characters is special and they are removed from posts hence why I need to put spaces in so that you can see the full script '&amp; # x 0 D ;''&amp;#x 0D;' Just remove the space between the x and the 0</description><pubDate>Tue, 18 Dec 2012 23:38:53 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>[quote][b]RK2012 (12/18/2012)[/b][hr]Can you please give me modified script[/quote][code="sql"]DECLARE @SQL NVARCHAR(MAX)		SELECT @SQL = REPLACE(							CAST(									(										SELECT 'USE ' + QUOTENAME(name) +';' + CHAR(13) + CHAR(10) +										'SELECT ' + CHAR(13) + CHAR(10) +										'DatabaseName = DB_NAME(), ' + CHAR(13) + CHAR(10) +										'a.FILEID, ' + CHAR(13) + CHAR(10) +										'[FILE_SIZE_MB] = CONVERT(DECIMAL(12, 2), ROUND(a.size / 128.000, 2)), ' + CHAR(13) + CHAR(10) +										'[SPACE_USED_MB] = CONVERT(DECIMAL(12, 2), ROUND(fileproperty(a.NAME, ' + CHAR(39) + 'SpaceUsed' + CHAR(39) +') / 128.000, 2)), ' + CHAR(13) + CHAR(10) +										'[FREE_SPACE_MB] = CONVERT(DECIMAL(12, 2), ROUND((a.size - fileproperty(a.NAME, ' + CHAR(39) + 'SpaceUsed' + CHAR(39) +')) / 128.000, 2)), ' + CHAR(13) + CHAR(10) +										'a.NAME, a.FILENAME ' + CHAR(13) + CHAR(10) +										'FROM dbo.sysfiles a;' + CHAR(13) + CHAR(10)										FROM sys.databases										FOR XML PATH('')									) 								AS NVARCHAR(MAX)							),						'&amp;#x0D;',CHAR(13) + CHAR(10)						)		print @SQL		EXECUTE sp_executesql @SQL[/code]</description><pubDate>Tue, 18 Dec 2012 23:17:18 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>Thanks anthony I have removed '&amp; # x 0 D ;' in script it is not working Can you please give me modified script</description><pubDate>Tue, 18 Dec 2012 21:29:43 GMT</pubDate><dc:creator>RK2012</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>[code="sql"]		DECLARE @SQL NVARCHAR(MAX)		SELECT @SQL = REPLACE(							CAST(									(										SELECT 'USE ' + QUOTENAME(name) +';' + CHAR(13) + CHAR(10) +										'SELECT ' + CHAR(13) + CHAR(10) +										'DatabaseName = DB_NAME(), ' + CHAR(13) + CHAR(10) +										'a.FILEID, ' + CHAR(13) + CHAR(10) +										'[FILE_SIZE_MB] = CONVERT(DECIMAL(12, 2), ROUND(a.size / 128.000, 2)), ' + CHAR(13) + CHAR(10) +										'[SPACE_USED_MB] = CONVERT(DECIMAL(12, 2), ROUND(fileproperty(a.NAME, ' + CHAR(39) + 'SpaceUsed' + CHAR(39) +') / 128.000, 2)), ' + CHAR(13) + CHAR(10) +										'[FREE_SPACE_MB] = CONVERT(DECIMAL(12, 2), ROUND((a.size - fileproperty(a.NAME, ' + CHAR(39) + 'SpaceUsed' + CHAR(39) +')) / 128.000, 2)), ' + CHAR(13) + CHAR(10) +										'a.NAME, a.FILENAME ' + CHAR(13) + CHAR(10) +										'FROM dbo.sysfiles a;' + CHAR(13) + CHAR(10)										FROM sys.databases										FOR XML PATH('')									) 								AS NVARCHAR(MAX)							),						'&amp; # x 0 D ;',CHAR(13) + CHAR(10)						)		--SELECT @SQL		EXECUTE sp_executesql @SQL[/code]This loops through all DB's pulling out the free space, used space, total space per file.Just remove the spaces between '&amp; # x 0 D ;'</description><pubDate>Tue, 18 Dec 2012 05:45:11 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>You can see this in Management Studio.1. Click on "Databases" in Object Explorer2. Select menu item "View -&amp;gt; Object Explorer Details" - a table is displayed showing all databases and few properties, including Size (MB)3. Right click on one of the column headings and make sure "Space Available (KB)" is checked.  You can uncheck other columns if you don't need themVoila</description><pubDate>Tue, 18 Dec 2012 05:42:17 GMT</pubDate><dc:creator>Richard Fryar</dc:creator></item><item><title>RE: How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>Google it sp_spaceused.</description><pubDate>Mon, 17 Dec 2012 22:40:22 GMT</pubDate><dc:creator>SQL Show</dc:creator></item><item><title>How to find allocated space and used space</title><link>http://www.sqlservercentral.com/Forums/Topic1397540-1550-1.aspx</link><description>Hello Team,How to find allocated space and used space for all databases in sqlserver instance ?Is there any query.Thanks in advance</description><pubDate>Mon, 17 Dec 2012 22:32:10 GMT</pubDate><dc:creator>RK2012</dc:creator></item></channel></rss>