August 20, 2001 at 1:25 am
I'm trying to use SQL-DMO to determine the size of the "northwind" database:
Dim oSQLServer
Dim oDatabase
Set oSQLServer = CreateObject("SQLDMO.SQLServer")
oSQLServer.Connect "tower2", "sa"
Set oDatabase = oSQLServer.Databases("northwind")
Msgbox oDatabase.Size
but .Size always returns the results in MB (not fine enough for me). For example, on my computer it returns 5 (MB) while EM show 4.25 -- the number I'm trying to get.
Any help much appreciated.
TIA,
Bill Salkin
August 20, 2001 at 3:40 pm
You can use the SizeInKB property of the Database2 object to get a more accurate measure of the DB size. The Size property of the Database object returns a long that is rounded to the MB, and won't get you enough detail.
Hope this helps.
Sean
August 20, 2001 at 4:31 pm
Or you could just execute sp_spacedused, which should match what you get in EM. Not pure DMO, but easy!
Andy
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy