萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> sql server教程 >> 查看數據庫中表、視圖等

查看數據庫中表、視圖等

<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查看數據庫中表、視圖等</title>
<!-- #INCLUDE FILE="ADOVBS.INC" -->
</head>

<body>
<%
    Dim Conn
    Dim RS
    Set Conn = Server.CreateObject("ADODB.Connection")
    Dim connstr
    connstr = "DBQ="+server.mappath("webdb.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;ImplicitCommitSync=Yes;MaxBufferSize=512;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;"
    'connstr = "DSN=Sql;UID=sa;PWD=;DATABASE=master"
    Conn.CursorLocation = adUseClient
    Conn.Open connstr
    Set RS = Conn.OpenSchema(adSchemaTables)
    %>
<div align="center"><center>
<table border="1">
  <tr>
    <td>庫名</td>
    <td>表名</td>
    <td>所有者</td>
    <td>類型</td>
    <td>描述</td>
  </tr>
    <%
    Do Until RS.EOF
        %>
  <tr>
    <td><% = RS("TABLE_CATALOG") %></td>
    <td><% = RS("TABLE_NAME") %></td>
    <td><% = RS("TABLE_SCHEMA") %></td>
    <td><% = RS("TABLE_TYPE") %></td>
    <td><% = RS("DESCRIPTION") %></td>
  </tr>
        <%
        RS.MoveNext
    Loop
%>
</table>
</center></div>
<p>在ACCESS、Microsoft sql server、IIS4、PWS4中均可運行。<br>
還有一個更直觀的辦法喲,就是直接用SQL語句<br>
Access: select * from MSysObjects;<br>
SQL Server: select * from dbo.sysobjects<br>
Oracle: select * from tab;<br>
不過如果你不加限制條件的話,就會一股腦兒把存儲結構呀,模塊呀什麼的全都查出來了<br>
露茜 1999年1月17日</p>
</body>
</html>

關鍵詞:視圖 

copyright © 萬盛學電腦網 all rights reserved