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 program is used to store the data source file?

0 Answers  


How do I create a partition table in sql server?

0 Answers  


What is the use of floor function in sql server?

0 Answers  


How to reaname table name without using sp_Rename in sql server..?

0 Answers   Wipro,


What is difference in performance between insert top (n) into table and using top with insert?

0 Answers  






How important do you consider cursors or while loops for a transactional database?

0 Answers  


About types of indexes in SQL server ?

2 Answers   Cognizant,


Mention the command used to rename the database.

0 Answers  


Rate yourself in .NET and SQL ?

1 Answers   Cognizant, HCL, SunGard,


What is an indexing technique?

0 Answers  


What is the command used to check locks in microsoft sql server?

0 Answers  


What does REVERT do in SQL Server 2005?

0 Answers   HCL,


Categories