Table rename

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.
 
W

Wolfgang Kais

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'
 
G

Guest

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.
 
G

Guest

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'
 
G

Guest

One other alternative is

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top