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

how many clustered indexes can be created on a table? : Sql server database administration

0 Answers  


Can we add a cpu to sql server?

0 Answers  


What is the use of Port no?

1 Answers   Wipro,


how to find maximum identity number in a table ?

2 Answers   JPMorgan Chase, Thomson Reuters, Wipro,


Does sql server 2000 clustering support load balancing?

0 Answers  






Do you know what is a trace frag? Where do we use it?

0 Answers  


Explain what is the use of custom fields in report?

0 Answers  


Explain the storage models of OLAP?

1 Answers  


what is the use of database index(apart from the last searching of records) and what is the use of composite key?

1 Answers  


I have a table Events Events containing cardno,time,id,name- -each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible

0 Answers  


Explain what are the events recorded in a transaction log?

0 Answers  


If a stored procedure is taking a table data type, how it looks?

1 Answers  


Categories