Syntax to find the used space and free space of the Data
file in a database(SQL Server). Following queries didn't
give the exact Used space and Free Space Information
sp_spaceused;DBCC showfilestats;exec
MyDbName.dbo.sp_spaceused;SP_HELPFILE

Can any one tell me the query for how to find the exact
used data file space and free space in a Data File?

Answers were Sorted based on User's Feedback



Syntax to find the used space and free space of the Data file in a database(SQL Server). Following..

Answer / narasimha

SELECT name ,size/128.0 - CAST(FILEPROPERTY
(name, 'SpaceUsed') AS int)/128.0 AS AvailableSpaceInMB
FROM sys.database_files;

Is This Answer Correct ?    4 Yes 1 No

Syntax to find the used space and free space of the Data file in a database(SQL Server). Following..

Answer / allah baksh

exec sp_spaceused [schema.tablename] this will give you
data file and the size available

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is Dedicated Administrator Connection in sql server 2005?

2 Answers  


what is procedure in sql?

2 Answers   Millennium, SQL,


Observed that some SP’s / Jobs are processing late, how to troubleshoot to improve performance?

1 Answers  


What is meant by referential integrity?

0 Answers   Blue Star,


What are the transaction properties?

0 Answers  


Difference between writing SQL query and stored procedure ?

15 Answers   Cognizant, Infosys, TCS, Veritas,


explain the storage models of olap? : Sql server database administration

0 Answers  


What is stored procedure in SQL..??

2 Answers  


How to find the latest updated value in a table without sending any parameters to that query

2 Answers  


What are the advantages of user-defined functions over stored procedures in sql server?

0 Answers  


Why do we use sql limitations? Which constraints can we use while making a database in sql?

0 Answers  


How to configure and test odbc dsn settings?

0 Answers  


Categories