Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming table in Access database using SQL 1

Status
Not open for further replies.

andybeh

IS-IT--Management
Sep 5, 2002
15
AU
Hi All,

Can someone help me with finding a way to rename a table in an Access 2000 database using SQL commands in asp please?

Either the solution or a pointer to the right resource would be great.

Cheers

ab
 
Use FSO

<%
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set fileObject = fso.GetFile(Server.MapPath(&quot;oldname.mdb&quot;))

response.write fileObject.Name & &quot;<br>&quot;
fileObject.Name = &quot;newname.mdb&quot;
response.write fileObject.Name
Set fileObject = Nothing
Set fso = Nothing

%>

 
A quick hack is to do this ...

&quot;SELECT * INTO <new table> FROM <old table>&quot;

this will create an identical copy of the old table. Then use this ...

&quot;DROP TABLE <old table>&quot;

... and you have what you want.

I'm sure there's a better way to do this. If you were using SQL Server you could use sp_rename, not sure if Access does the stored procedure thing though.

Regards,

Patrick
 
RENAME TABLE OLDNAME TO NEWNAME


_____________________________________________________________________
onpnt2.gif

Hakuna matata!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top