good article but i think there is a typo in one example (it returns @sum , but should return @answer) i rarely use return except for maybe a 0 or 1: i would select instead.
Dewes, I don’t think anybody addressed your question and I didn’t see anything about 'post your question in the XXXXX forum', so here goes (simply).
SP_spaceused is a system stored procedure that returns 2 recordsets: you can access these as recordsets in VB Script just like you would any other recordset, but there are 2 so you will need to access the 2nd one with rs.nextrecordset:
got this from VB Help: paste it in a vbs file, point it to a server and db by changing the connection dtring and save and run:
set strCnn = createobject("adodb.connection")
strCnn.connectionstring = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=XX_DBNAME_XX;Data Source=XX_ServerName_XX"
Set rstCompound = createobject("adodb.Recordset")
rstCompound.Open "exec SP_spaceused", strCnn, , , adCmdText
' Display results from each SELECT statement.
intcount = 1
Do Until rstCompound Is Nothing
msgbox "Contents of recordset #" & intCount
Do While Not rstCompound.EOF
msgbox rstCompound.Fields(0) & ", " & rstCompound.Fields(1)
Set rstCompound = rstCompound.NextRecordset
intCount = intCount + 1
you are going to have to modify the code to get the data how you want it.
another option might even be easier:
point to master in QA and paste 'sp_helptext SP_spaceused'. copy it then modify it to return 5 or 6 output params as describe in the article.
the 1st option you can do without modifying the database. you can create your own proc with the new sql and decide where to create and how to name it