How can I rename an existing custom table?

HelenaG Grulichova asked on May 2, 2012 08:19

How can I rename an existing custom table?

Correct Answer

HelenaG Grulichova answered on May 2, 2012 08:19

To change customtable.oldname to customtable.newname:
 
First, rename the table using SQL Server Management Studio from “customtable_oldname” to “customtable_newname”.
 
Then, edit the custom table from Site Manager -> Development -> Custom Tables and change the display name and the second part of the code name to newname.
 
Next, run the following SQL statement against your Kentico database:
 

UPDATE [CMS_Class]
SET [ClassTableName] = 'customtable_newname'
WHERE [ClassTableName] = 'customtable_oldname'
GO


 
Finally, edit the table from the Site Manager again and switch to the Queries tab. Update all of the queries to refer to the new table name.
 

-ag-
0 votesVote for this answer Unmark Correct answer

Recent Answers


Lance Keay answered on September 20, 2016 18:33

Should I follow the same steps to rename the base table of any custom class type? eg: we have custom Page Type classes that we'd like to rename the tables of.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.