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?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know the cursor optimization tips?

590


What is perspective, have you ever created perspective? : sql server analysis services, ssas

498


What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas

550


what authentication modes does sql server support? : Sql server database administration

521


List some case manipulation functions in sql?

599






Explain indexing and what are the advantages of it?

531


Does index slows down insert statements?

586


Explain how you can deploy an SSRS report?

106


What is blocking?

569


what is nonclustered index

546


What are different types of join?

762


Is truncate autocommit?

563


What is the use of partition by in sql server?

513


What are ddl triggers and types of ddl trigger?

608


What is nolock hint in sql server 2008

635