sql查询语句问题:有人知道如何用SQL语句返回数据库myexample中所有表的表名吗?

sql查询语句问题:有人知道如何用SQL语句返回数据库myexample中所有表的表名吗?
---------------------------------------------------------------

select name from sysobjects where xtype='U'

表信息都是放在系统对象表中的
---------------------------------------------------------------

读取access中所有表
set rsSchema=conn.openSchema(20)
rsSchema.movefirst
Do Until rsSchema.EOF
if rsSchema("TABLE_TYPE")="TABLE" then
response.write rsSchema("TABLE_NAME")
end if
rsSchema.movenext
Loop

 1判断表是否存在   
 2rs.open "select * from sysobjects where name='表名'",conn,1,1   
 3if rs.eof then   
 4'没有该表'   
 5else   
 6'可以操作该表   
 7end if   
 8  
 9  
10  
11  
12  
13  
14\---------------------------------------------------------------   
15  
16在查询分析器中:   
17use yourtable   
18select * from sysobjects where xtype='U'   
19\---------------------------------------------------------------
20<!-- #INCLUDE VIRTUAL="/adovbs.inc" -->
21```
22   
23Set Con = Server.CreateObject( "ADODB.Connection" )   
24Con.Open "FILE NAME=c:\yourDataLink.UDL"   
25queryType = adSchemaTables   
26criteria = Array( "myexample", Empty, Empty, "TABLE" )   
27Set RS = Con.OpenSchema( queryType, criteria )   
28While NOT RS.Eof   
29Response.Write RS( 2 ) & "
30```
31&lt;br/&gt;
32```
33"   
34RS.MoveNext   
35Wend   
36
37```   
38adovbs.inc文件在你安装IIS的时候就安装在相应的目录下了,请你查找到文件,并复制到相应的目录下
Published At
Categories with Web编程
comments powered by Disqus