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
~~~~~~~~~~~~~~~~~~~~~~~~
判断表是否存在
rs.open "select * from sysobjects where name=表名",conn,1,1
if rs.eof then
没有该表
else
可以操作该表
end if
在查询分析器中:
use yourtable
select * from sysobjects where xtype=U
<!-- #INCLUDE VIRTUAL="/adovbs.inc" -->
<%
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "FILE NAME=c:\yourDataLink.UDL"
queryType = adSchemaTables
criteria = Array( "myexample", Empty, Empty, "TABLE" )
Set RS = Con.OpenSchema( queryType, criteria )
While NOT RS.Eof
Response.Write RS( 2 ) & "<br>"
RS.MoveNext
Wend
%>
adovbs.inc文件在你安装IIS的时候就安装在相应的目录下了,请你查找到文件,并复制到相应的目录下