Re: Rename table

From: Adam Machanic (amachanic_at_air-worldwide.nospamallowed.com)
Date: 03/15/04


Date: Mon, 15 Mar 2004 10:09:24 -0500

You can use sp_rename ... Look it up in BOL.

Note, this isn't an ANSI SQL statement. I don't know of any way to rename a
table in pure SQL other than creating a new table and moving all of the
data.

"GeoWorks" <rcetrangolo@geoworks.com.uy> wrote in message
news:88A6B4A5-69F8-4D87-B002-BBC054170A8B@microsoft.com...
> I want to rename a table using an SQL statement.
> I know in many data bases I can write 'ALTER TABLE pp RENAME TO pp2' to
change the name of 'pp' table to 'pp2'.
> It seems doesn't work in SQL Server.
> There is a way to rename a table using only ANSI SQL statement?, I meen
I'm not programming over the database, I'm just progamming an upper layer to
writes SQL scripts to merge database models and I have to rename certain
tables to preserve its values (if there are some) and then try to copy
values to the new table definition (if it is possible).
>
> Thanks



Relevant Pages

  • Re: Table rename
    ... > I'm trying to Rename a table using a query. ... > looking for the correct syntax for the sql statement but I've had no luck. ... To rename a table in a SQL Server database, ...
    (microsoft.public.access.queries)
  • Re: Making SQL updates to a table named COLUMN
    ... Using rename table does not seem to work, ... use " " around the illegal field name. ... can I use an SQL statement to rename the table? ... Prev by Date: ...
    (microsoft.public.access.queries)
  • Re: Making SQL updates to a table named COLUMN
    ... There is no RENAME in JET. ... Vanderghast, Access MVP ... >>> Insert into and delete from SQL statements work fine with the table, ... can I use an SQL statement to rename the table? ...
    (microsoft.public.access.queries)
  • RE: Rename a table with a SQL
    ... sp_rename table1, table2 ... "Serge Fournier" wrote: ... > is it possible to rename a table with a SQL statement? ...
    (microsoft.public.sqlserver.programming)

Loading