sp_rename (SQL Server Compact)
Changes the name of a user table in the current database. Currently, sp_rename support in SQL Server Compact is limited to tables.
Syntax
sp_rename [ @objname = ] 'object_name' , [ @newname = ] 'new_name'
[ , [ @objtype = ] 'object_type' ]
Arguments
[ @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.
Return Code Values
0 (success) or a nonzero number (failure)
Remarks
The names of most system objects cannot be changed.
Examples
Renaming a table
The following example renames the Order Details table to OrderDetails.
sp_rename 'Order Details', 'OrderDetails';