Somehow one of our tables was accidentally renamed to 'sp_help'.
We have tried to rename it back to the previous table name using sp_rename but we are getting the following error:
Msg 15225, Level 11, State 1, Procedure sp_rename, Line 332
No item by the name of 'MyDatabase.dbo.sp_help' could be found in the current database 'MyDatabase', given that @itemtype was input as '(null)'.
We have also tried to rename it directly in management studio with the same error. Is there any other way of renaming this table back to the previous name?
Uncheck the table you want to rename, then rename the table, then re-add it to the article list (make sure to uncheck "Show only checked articles in the list" option to see all addable objects). Then start a new snapshot in the snapshot agent: Local Publications -> Properties -> View Snapshot Agent Status -> Start.
Any database user can easily change the name by using the RENAME TABLE and ALTER TABLE statement in Structured Query Language. The RENAME TABLE and ALTER TABLE syntax help in changing the name of the table.
ALTER the metadata of the dbo.sp_help object and perform a SWITCH.
Here's a test case that should get you started:
CREATE TABLE dbo.t_Foo
(
Bar BIT
);
GO
EXECUTE dbo.sp_rename @objname = 'dbo.t_Foo', @newname = 'sp_help';
GO
CREATE TABLE dbo.t_Foo
(
Bar BIT
);
GO
ALTER TABLE [dbo].[sp_help]
SWITCH TO dbo.t_Foo;
GO
SELECT *
FROM dbo.t_Foo;
GO
DROP TABLE [dbo].[sp_help]
GO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With