What is the best way to retrieve the used size of a (sql) Database in c#?
I have access to the connection string of the database and assume I also have dbadmin access to the database.
This place suggests that I use Microsoft.SqlServer.Smo.dll, however I would like to know if it is possible to do this using the Sql* namespaces in System.Data itself? (like SqlConnection, DbConnection, etc)
sp_spaceusedreturns allocated and unused space. ( http://msdn.microsoft.com/en-us/library/ms188776.aspx ), subtract the latter from the former to get the actual used space.For sql server variants.
Just create a DbConnection and execute this sproc
how to query sql server database size