Which is the best way to check the size of a database from Transact SQL ? (Selecting from Sysfiles gives a totally different result compared to right-clicking a database and selecting Properties. It's the result from the latter than I want to obtain through Transact sQL.)exec sp_spaceused|||might want to throw in the updateusage parameter.|||btw, if you ever want to know exactly what EM or SSMS is doing to get the results it's showing you, just turn on the profiler and start clicking around in EM/SSMS.
EDIT: Really, this will tell you what DMO/SMO is doing, since EM and SSMS use DMO and SMO under the covers.|||just turn on the profiler and start clicking around in EM/SSMS.
And I alway get very sad when I see just how much traffic just one click in EM generates... :eek:|||you think that's bad, try SSMS. SMO is a very chatty api.|||you think that's bad, try SSMS. SMO is a very chatty api.
I'm not sure I want to know ;) The only thing that can make it a little more easier to live with if the uncatchable "refresh"-problem in EM is history in SSMS:
Me: I just created the table you wanted
Developer: <click><click> I don't see it
Me: Did you refresh the table list? You were probably already connected before I created it.
Developer: <click><click><click> I did, but I still don't see it
Me: Did you do a refresh on the instance or on the table list, you must refresh the table list separately
Developer: <click><click><click> Did that but I still don't see it
Me: <sigh> just disconnect and reconnect...
Developer: <click><click><click> Ah, there it is!|||I was just about to try tracking what, in my case,
Mgmt Studio Express, is doing, but sp_spaceused
did the trick!
Thank you!|||fyi, you can also pass a table name to sp_spaceused to get the size of data/indexes in it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment