To get the size of the database, the size of the database space used

Source: Internet
Author: User
Data | Database Execute this
EXEC sp_spaceused

Test code
<%
Set Rs=server. CreateObject ("Adodb.recordset")
sqlstr= "Exec sp_spaceused"
Rs.Open sqlstr,conn,1,1

If Rs.eof=false Then
Response.Write Rs (0) &rs (1) &rs (2) ' Returns the test value test25.38 MB6.34 MB
' RS (0) is the database name, RS (1) is the database space, RS (2) is the free space
End If

Rs.close
Conn.close
%>


It's okay to write.

<%
Set Rs=server. CreateObject ("Adodb.recordset")
sqlstr= "Exec sp_spaceused"
Rs.Open sqlstr,conn,1,1

Response.Write RS ("database_name") ' Database name
Response.Write rs ("database_size") ' Database space
Response.Write rs ("Unallocated_space") ' Free space

%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.