Export (0) Print
Expand All
Expand Minimize

sp_rename (SQL Server Compact)

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

[ @objname = ] 'object_name'

Is the name of the user object.

The object_name is nvarchar(776),  with no default.

[ @newname = ] 'new_name'

Is the new name for the user object.

The new_name must be a one-part name and must follow the rules for identifiers. The newname is nvarchar(128), with no default.

[ @objtype = ] 'object_type'

Is the type of the object that is being renamed. The object_type is nvarchar(13), with a default of NULL.

0 (success) or a nonzero number (failure)

The names of most system objects cannot be changed.

Renaming a table

The following example renames the Order Details table to OrderDetails.

sp_rename 'Order Details', 'OrderDetails';
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft