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
What is the difference between nvl and nvl2?
Explain the various types of concurrency problem?
How to loop through returning rows?
What are trace files?
Can multiple columns be used in sql group by clause in ms sql server?
What is a non clustered primary key?
Explain the dirty pages?
If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?
What is use of attribute hierarchy optimized state? : sql server analysis services, ssas
How to delete duplicate rows from table except one?
What are ddl (data definition language) statements for tables in ms sql server?
What are wait types?
What are orphan records?
Where actually sql azure database is hosted?
What are the types of resultset?