views:

516

answers:

2

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?

+6  A: 

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' ]

You can also do it from code: Renaming a SQL CE Table From a .NET CF Application

There is also a third party application that can do this: Primeworks

Mitch Wheat
The third-party app did the job, thanks!
romkyns
Great answer. +1
ctacke
+2  A: 

To rename the table oldtable to newtable:

sp_rename oldtable, newtable;
Anders Olsson
With single quotes around table names.
AndrewS