If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > renaming a table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-04, 16:55
softie() softie() is offline
Registered User
 
Join Date: Sep 2004
Posts: 21
renaming a table

how do i rename a table? i tried making a copy of it (select * into copy from original), but it turns out that doesn't work either... =(
Reply With Quote
  #2 (permalink)  
Old 12-08-04, 19:19
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
The method for renaming objects depends on which database engine you are using.

-PatP
Reply With Quote
  #3 (permalink)  
Old 12-09-04, 08:09
Madhivanan Madhivanan is offline
Registered User
 
Join Date: Oct 2003
Posts: 357
In SQL 2000
Code:
Select * into newTable from OldTable
drop Table OldTable
Madhivanan
Reply With Quote
  #4 (permalink)  
Old 12-09-04, 19:41
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
in sql server
Code:
sp_rename 'tablename' , 'newname'
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On