How to know DB Size when FILEGROWTH applied?
MS SQL 2008.
I have a DataBase which use FILEGROWTH (this property specifies the growth increment of the DB.).
As soon as my DataBase reach the size of 40MB DB it will be expanded +20 MB (FILEGROWTH) till reach the MAXSIZE... Correct?
If it is Correct, how can I get the Current Size
for all the Rows in any Tables in my DB... I would like to know if is possible have the Size for the Actual Content an not Db SIZE+FILEGROWTH.
Hope guys I can have a clear expl开发者_运维技巧anation, I'm pretty new with DB. Thanks for your help!
Here the code I use.
CREATE DataBase MyDB
ON PRIMARY
(
NAME = 'MyDB',
FILENAME = 'C:\Server\Data\DataBase\MyDB.mdf', -- Location DataBase
SIZE = 40 MB,
MAXSIZE = 960 MB,
FILEGROWTH = 20 MB
)
LOG ON
(
NAME = 'MyDB',
FILENAME = 'C:\Server\Data\DataBase\MyDB.ldf', -- Location Log files
SIZE = 20 MB,
MAXSIZE = 960 MB,
FILEGROWTH = 20 MB
)
WITH DB_CHAINING OFF
GO
The quick way is to run sp_spaceused with no parameters
If you look at the code of this proc, you should see queries based on sys views etc of you want something slightly cleverer
Edit: I did this before: How do I find out what tables have data in a file in SQL Server?
精彩评论