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

主宰稳场 提交于 2019-12-05 12:11:21

问题


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?


回答1:


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



回答2:


To rename the table oldtable to newtable:

sp_rename 'oldtablename', 'newtablename';


来源:https://stackoverflow.com/questions/1528805/how-do-i-rename-a-table-in-sql-server-compact-edition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!