Table rename

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to Rename a table using a query. I've searched the net looking
for the correct syntax for the sql statement but I've had no luck. Any help
is appreciated.
 
Gabe.

Gabe said:
I'm trying to Rename a table using a query. I've searched the net
looking for the correct syntax for the sql statement but I've had no luck.
Any help is appreciated.

In an mdb, you will have to use VBA with DoCmd.Rename.
To rename a table in a SQL Server database, use a system stored procedure:
EXEC sp_rename 'oldname', 'newname'
 
You can't rename a table using query, but you can run create table query to
create a new table with the name you want.
If that what you looking for, then create a query that return values, change
it from select query to create table query, Access will ask for the name of
the new table.
 
Thanks that worked perfectly.

Wolfgang Kais said:
Gabe.



In an mdb, you will have to use VBA with DoCmd.Rename.
To rename a table in a SQL Server database, use a system stored procedure:
EXEC sp_rename 'oldname', 'newname'
 
One other alternative is

SELECT * INTO <new table name> FROM <old table name>;
DROP TABLE <old table name>
 
Back
Top