Re: Rename table

From: Itzik Ben-Gan (itzik_at_REMOVETHIS.SolidQualityLearning.com)
Date: 03/15/04


Date: Mon, 15 Mar 2004 17:08:38 +0200

T-SQL has the sp_rename procedure to rename tables, e.g.,

EXEC sp_rename 'T1', 'T2'

-- 
BG, SQL Server MVP
www.SolidQualityLearning.com
"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
    ... I've only seen problems with SQL Server 7 (ie and MSDE v1). ... >> In my experience when you rename a computer ...
    (microsoft.public.sqlserver.msde)
  • 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: 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)