|
Building on this question how would one store the results of the following: It spits out multiple rows and doesn't insert so nicely.
(comments are locked)
|
|
Try this: With a slight mod, you could have this insert into your table. You can also find that on my blog at http://jasonbrimhall.info/2010/05/25/space-used/ WOW - tons 'o info from that! Still playing with it, probably Monday now before I get a chance to dig deeper.
Oct 01 '10 at 01:48 PM
Blackhawk-17
Thanks When I tinkered with the scripts (if you follow the series there are two similar scripts based on the MS procs) I was considering expanding it to include more info. I still have to think about it for a bit.
Oct 01 '10 at 02:00 PM
CirqueDeSQLeil
+1 - awesome
Oct 02 '10 at 12:57 AM
Matt Whitfield ♦♦
thanks matt
Oct 02 '10 at 07:00 AM
CirqueDeSQLeil
(comments are locked)
|
|
If you are just looking to capture the size of your database and store this for historical reasons and for monitoring try using sysfiles instead of sp_spaceused. One of the things I want from sp_spaceused is space available to plan for growth.
Oct 01 '10 at 01:03 PM
Blackhawk-17
Depending on your set-up, xp_fixeddrives, might be helpful
Oct 01 '10 at 03:43 PM
Scot Hauder
(comments are locked)
|
|
Hello Try the below script I get a "Msg 213, Level 16, State 7, Procedure sp_spaceused, Line 180 Insert Error: Column name or number of supplied values does not match table definition." when I try it, which is roughly what I would have expected from reading over it. Am I perhaps missing something that needs to be tweaked or misunderstanding some portion of it?
Oct 01 '10 at 01:28 PM
TimothyAWiseman
(comments are locked)
|
|
I am not aware of a way to do this within T-SQL, and some quick research did not turn up a way. I suspect that it may not be possible in pure T-SQL, but I would be glad to be proven wrong. On the other hand, if you step out of pure T-SQL most client languages make it relatively easy to deal with multiple returned data sets. If you are using C# for instance, you should just be able to use the NextResult method, as described here http://csharp.net-informations.com/data-providers/csharp-multiple-resultsets.htm and here: http://www.mindfiresolutions.com/NextResult-in-C-or-ADONET-data-reader-705.php If you are using python with pyodbc, then you can use the nextset function of the cursor to advance to the next dataset. See http://code.google.com/p/pyodbc/wiki/Cursor#nextset
(comments are locked)
|

