<%
oConnStr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\Database\#Database.mdb"
Sub RenameTable (oldName, newName)
Dim objADOXDatabase
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
objADOXDatabase.ActiveConnection = oConnStr
objADOXDatabase.Tables(oldName).Name = newName
Set objADOXDatabase = Nothing
End Sub
'Sub DBConnBegin()
Set oConn=server.CreateObject("adodb.Connection")
oConn.Open oConnStr
If Err.Number>0 Then
Response.End
End If
Const adSchemaTables = 20
adSchemaColumns = 4
Set rstSchema = oConn.OpenSchema(adSchemaColumns)
tablename=""
Do Until rstSchema.EOF
If rstSchema("Table_name")<>tablename then
tablename = rstSchema("Table_name")
response.write tablename & "<BR>"
If InStr(LCase(tablename),"oldname")>0 then
tablename1=Replace(LCase(tablename),"oldname","CMS_")
Call RenameTable(tablename, tablename1)
End If
end if
rstSchema.MoveNext
Loop
%>
更多的批量修改ACCESS数据库表名请到论坛查看: http://BBS.TC711.COM
【 双击滚屏 】 【 评论 】 【 收藏 】 【 打印 】 【 关闭 】
来源:
互联网
日期:2009-5-14