Re: Rename table

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 03/15/04


Date: Mon, 15 Mar 2004 16:08:25 +0100

There is no ANSI SQL way to rename a table (in the ANSI SQL standard). This
is the reason (methinks) why MS haven't introduced renaming a table using
ALTER TABLE. In SQL Server, you use sp_rename to rename a database object.

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"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: Rename SQL Server Virtual name in 2003 Cluster
    ... The ONLY SUPPORTED way to rename a virtual SQL name is to uninstall and reinstall as documented in Microsoft Knowledge Base article ... How to Change a Clustered SQL Server Network Name ... "Cluster Administrator provides a method to rename cluster resources. ...
    (microsoft.public.sqlserver.clustering)
  • Re: microsoft sql, excel/access data transfer problems
    ... I don't use the MS tools, but if it's the field name causing the problem then you could try delimiting the field name "CU#">500 or creating an LF or View to rename the fields. ... An SQL View is equivalent to a non-keyed LF. ... This Redbook would be a good resource to learn about SQL vs DDS: ... It gives me an error (Query wizard cannot join ...
    (comp.sys.ibm.as400.misc)
  • Re: Renaming Computer Running SQL or MSDE
    ... Thanks for the response Jim, but earlier versions of MSDE and SQL ... >> to suspect that it is permissible to rename a computer that is running ...
    (microsoft.public.sqlserver.msde)
  • Re: Do you have to rename ASPNETDB.MDF for ASP.NET 2.0 Web Hosters?
    ... to deploy a SQL Express database to a site experimentally. ... It's just a database file in a dir... ... >>> My web hoster says that I have to rename my ASPNETDB.MDF SqlExpress db ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Connecting to SQL Express 2005
    ... The Host Name is the name of the PC's present name. ... installed SQL 2005 Express on the renamed PC. ... Click on SQL Server 2005 Services, ... particular PC and rename it back to this the application can then connect. ...
    (microsoft.public.dotnet.languages.vb)