Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding size of DB and its log in SQL 7

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, I am working in VB and SQL and I am looking for a way to find size of DB and its log for stats purposes. I tried using sp_helpdb and I can see results query analizer, but VB can't find those values... are there any other methods or property that I can use?

Thanks
 
Well you can call a Stored Procedure from VB or VBA and the information is returned in recordset in Columns and rows (fields and records)

And you can hunt through there looking for specific info

Here is a sample of one I did for getting the column names using the SP_COLUMNS

So you can run your SP, debug.print the results to see what it returns

Dim Conn As ADODB.Connection
Dim Rst2 As ADODB.Recordset
Set Conn = New ADODB.Connection
Set rs2 = New ADODB.Recordset
Conn.Open "driver=SQL Server;server=yourservername;uid=sa;pwd=;database=yourdatabase;"
Dim SQLCode, SQLCode2 As String
' this uses the stored Procedure SP_COLUMNS
SQLCode2 = &quot;sp_columns @table_name = 'DailyEvents'&quot; '< Dailevents is the table name
rs2.Open SQLCode2, Conn, adOpenStatic, adLockOptimistic

rs2.MoveNext ‘I moved two records down cause the first two columns I did not need
rs2.MoveNext

Do While Not rs2.EOF
Debug.Print rs2!COLUMN_NAME
rs2.MoveNext
Loop
--------------

SQL is real powerful



DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top