最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
试过列出一个数据库里所有的主键吗?
时间:2022-06-30 10:13:23 编辑:袖梨 来源:一聚教程网
<%
dbname = "databasename"
ConnStr = "provider=SQLOLEDB;network=DBMSSOCN;"
ConnStr = ConnStr & "uid=;pwd=;server="
ConnStr = ConnStr & " Address>;database=" & dbname
set Conn = server.createobject("adodb.connection")
Conn.Open ConnStr
sql = "SELECT so1.name AS keyName, so2.name AS tableName "
sql = sql & "FROM sysobjects so1 INNER JOIN sysobjects so2 "
sql = sql & "ON so2.id = so1.parent_obj WHERE (so1.xtype='PK')"
set rs = Conn.execute(sql)
do while not rs.eof
response.write(rs(0) & " is PrimaryKey for " & rs(1) & "
")
rs.movenext
loop
rs.close: set rs = nothing
Conn.Close: set Conn = nothing
%>
dbname = "databasename"
ConnStr = "provider=SQLOLEDB;network=DBMSSOCN;"
ConnStr = ConnStr & "uid=
ConnStr = ConnStr & "
set Conn = server.createobject("adodb.connection")
Conn.Open ConnStr
sql = "SELECT so1.name AS keyName, so2.name AS tableName "
sql = sql & "FROM sysobjects so1 INNER JOIN sysobjects so2 "
sql = sql & "ON so2.id = so1.parent_obj WHERE (so1.xtype='PK')"
set rs = Conn.execute(sql)
do while not rs.eof
response.write(rs(0) & " is PrimaryKey for " & rs(1) & "
")
rs.movenext
loop
rs.close: set rs = nothing
Conn.Close: set Conn = nothing
%>
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22