Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rename a table in SQL Server Compact Edition?

I've designed my SQL CE tables using the built-in designer in VS2008. I chose the wrong names for a couple. I am now completely stuck trying to find a way to rename them.

I am refusing to believe that such a feature could have been "forgotten". How do I rename an existing table using the VS2008 designer, or a free stand-alone app?

like image 527
Roman Starkov Avatar asked Oct 07 '09 00:10

Roman Starkov


People also ask

Which command is used to RENAME a table in SQL?

Running The Alter Command Click the SQL tab at the top. In the text box, enter the following command: ALTER TABLE exampletable RENAME TO new_table_name; Replace exampletable with your table's name and replace new_table_name with the new name for your table.

How do I RENAME a table in SQL Server 2008 r2?

If you select the table, you can change the table's name in the Properties pane. If you do not see the Properties pane, simply press F4 and it should automatically appear on the right side of the Studio Manager. The top section of Properties is (Identity) and Name is the first property.


1 Answers

Not sure about doing it via VS2008, but you can use sp_rename: Changes the name of a user table in the current database. Currently, sp_rename support in SQL Server Compact 3.5 is limited to tables.

sp_rename [ @objname = ] 'object_name', 
          [ @newname = ] 'new_name' 
          [ , [ @objtype = ] 'object_type' ]
like image 193
Mitch Wheat Avatar answered Nov 03 '22 01:11

Mitch Wheat