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 the difference between varchar and varchar types?

0 Answers  


Explain why variables called the most powerful component of ssis?

0 Answers  


What is a db view?

0 Answers  


Explain the basic concepts of SQL server architecture?

2 Answers   College School Exams Tests,


How to insert data with null values?

0 Answers  






Can you roll back the ddl statement in a trigger?

0 Answers  


Explain few of the new features of sql server 2008 management studio

0 Answers  


Is it possible to import data directly from t-sql commands without using sql server integration services? If so, what are the commands?

0 Answers  


What is DAC? what is the use of it?

1 Answers   Wipro,


How to find the service pack installed? : sql server database administration

0 Answers  


syntax and example for bitmap index in sql???

1 Answers  


How to replace the Query Result 'Null Value' with a text ?

0 Answers   MCN Solutions,


Categories