views:

19

answers:

2

I checked the size of the file itself - it said it's 4.02 GB. I checked the size mentioned in properties of the database using SSMSE - it said the size was somewhere above 4000 MB.

I then executed sp_spaceused and it said that the file size was above 4500 MB and the unallocated space was close to 4100 MB.

I'm a little confused as to how this works. I'm using SQL Server Express so I need to monitor the db size to figure out if it's reaching its limit. How do I figure out the in-use db size?

A: 

Hi, if storage is your problem, try using SHRINKFILES or SHRINKDATABASE on the database regularly. After that, you can check the size of the file. Good luck.

Rob van der Veer
storage is not the problem. right now i'm just trying to figure out the correct way to find out the database size. i'm sure the file size (mdf file) is not the database size. coz if it is, my file is already 4 gb, so my database size is already 4 gb...so sql server express wouldn't let me store any more data in this db, right?
SaM
+1  A: 

You're on the right track for analyzing the file use. The actual numbers will vary slightly for different reasons. For example, the file size greater than 4500 MB and the unallocated space of 4100 MB from sp_spaceused include the transaction log file (file with .ldf extension). The tran log is separate from your user data; so, for user-data space analysis exclude the space allocated for the tran log.

The file size represents disk space that has been reserved for your database, but not necessarily used by the database. You have to look at the SQL Server information to learn how much of that file is actually in use.

Your database size will reflect the approximate size of the database. This is the amount of file space that is allocated to the database. The unallocated space is the amount of file space that is not in use by the database and is available for new data. So, your current space used is approximately 400 MB (4500 - 4100 MB). And, the unused space is about 4100 MB.

bobs