Thursday, June 7, 2007

How do you know diskspace used by tables in a SQL database?

Use the following stored procedure to view space used by every table:

exec sp_spaceused


Or you can use the undocumented foreachtable function in combination with that.


exec sp_MSforeachtable 'exec sp_spaceused ''?'';'

How to reclaim the diskspace from SQL log file (.LDF)?

To reclaim disk space from SQL log file

- Detach the database using Enterprise manager or Stored procedure.
- Delete the log file physically
- Attach the database using Enterprise Manager which will create a new log file for the database

Subscribe free via email

Enter your email address:

Delivered by FeedBurner

...