15

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?

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
  • 1
    Using the SQL Server Compact Toolbox for VS this can be done: http://erikej.blogspot.com/2007/08/hidden-gem-rename-table.html as answer to this later question shows: http://stackoverflow.com/questions/2854661/how-to-rename-a-table-in-the-sql-server-compact-edition – Danny Varod Apr 30 '12 at 15:36

2 Answers2

19

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' ]
Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • Hey, that's a great third party app! Thanks for the tip! :-) (It has a 30 day trial version) – René Mar 09 '12 at 14:47
18

To rename the table oldtable to newtable:

sp_rename 'oldtablename', 'newtablename';
Anders
  • 289
  • 2
  • 3