change table name
am 01.11.2004 01:37:39 von xarrisx
Is there any way to change a table name with asp code
I have a table named unknown in my access database.
Looks like "unknown" is a reserved word and there are errors if a create a
recordset asking data from this table.
I want A SQL statement to change the table name online.
(why is unknown reserved??-just curius)
Re: change table name
am 01.11.2004 15:05:21 von ten.xoc
Did you try wrapping the word in square brackets?
SELECT * FROM [Unknown]
To change the table's name, you can use ADOX:
<%
oldTable = "old_table_name"
newTable = "new_table_name"
cst = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
cst = cst & server.mappath("/.mdb")
set conn = CreateObject("ADODB.Connection")
conn.open cst
Set adox = CreateObject("ADOX.Catalog")
adox.ActiveConnection = Conn
adox.Tables(oldTable).Name = newTable
adox.Tables.Refresh
Set adox = nothing
conn.close: set conn = nothing
%>
--
http://www.aspfaq.com/
(Reverse address to reply.)
"xarrisx" wrote in message
news:OcGE2#AwEHA.200@TK2MSFTNGP11.phx.gbl...
> Is there any way to change a table name with asp code
>
> I have a table named unknown in my access database.
> Looks like "unknown" is a reserved word and there are errors if a create a
> recordset asking data from this table.
>
> I want A SQL statement to change the table name online.
> (why is unknown reserved??-just curius)
>
>