Discussion Locked

access 2000

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
how can i rename a table name in access 2000 database from an asp page using sql?

5 replies

by andrew

Here's a way using the ADOX Library:

Dim oCon 'As ADODB.Connection
Dim oCatalog 'As ADOX.Catalog
Dim oTable 'As ADOX.Table

Set oCon = Server.CreateObject("ADODB.Connection")
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\File.mdb;"
Set oCatalog = Server.CreateObject("ADOX.Catalog")
Set oCatalog.ActiveConnection = oCon
Set oTable = oCatalog.Tables("OldTable")
oTable.Name = "NewTable"

oCon.Close

by andrew

Trying to do this enirely from SQL is difficult.

A query like:

UPDATE MSysObjects SET MSysObjects.Name = 'TableNew'
WHERE (((MSysObjects.Id)=44));

Runs into permission problems, and modifying the system table can be tricky.

SQL Server provides a system stored procedure for object renaming, but its over 400 lines long.

This discussion is closed to new replies.