← Desenvolvimento

SQL - Alterar nome de uma tabela

Lida 1791 vezes

Offline

Celso Azevedo 
Membro
Mensagens 3500 Gostos 38
Feedback +12

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Tenth year Anniversary Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Olá,
tenho uma base de dados e quero alterar o nome de uma tabela.

O nome da tabela actual é blog_ngg_album e queria alterar para site_ngg_album

Já procurei no google e tentei vários comandos, mas ao tentar da este erro:
Citar
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

Um dos comandos que utilizei foi este:
Citar
ALTER TABLE blog_ngg_album RENAME TO site_ngg_album

Alguém sabe como fazer ?

Obrigado  :grin:
Offline

fdfandrade 
Membro
Mensagens 150 Gostos 0
Feedback +6

Troféus totais: 26
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 100 Posts

Olá Celso,

Tentar usar assim: RENAME TABLE blog_ngg_album TO site_ngg_album;

Cumps
Offline

Celso Azevedo 
Membro
Mensagens 3500 Gostos 38
Feedback +12

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Tenth year Anniversary Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Olá,
funcionou :P

Obrigado!