Somehow, decades ago, a table got created in our database that starts with a #
. It shows up in Object Explorer under the app's database, not in tempdb
. For some reason, Azure won't import the database like this.
We can't drop it, rename it, or interact with it. I've tried Delete from Object Explorer, Script Drop, Rename from the GUI and none of them have worked.
We're on SQL 2008 R2.
drop table [*app*].[dbo]."#OBSOLETE";
Database name '*app*' ignored, referencing object in tempdb.
Msg 3701, Level 11, State 5, Line 1
Cannot drop the table '#OBSOLETE', because it does not exist or you do not
have permission.
exec sp_rename "dbo.#OBSOLETE", "dbo.obsolete"
Msg 15225, Level 11, State 1, Procedure sp_rename, Line 338
No item by the name of 'dbo.#OBSOLETE' could be found in the current database '*app*', given that @itemtype was input as '(null)'.
How do we kill this object so we can migrate this to Azure?
SELECT [name], CONVERT(VARBINARY(128), [name]) FROM sys.tables WHERE [name] = N'#OBSOLETE';
. Thanks.object_id
of that table. 2) Restart the instance in single-user mode. 3) connect via Dedicated Admin Connection. 4) In that DB, try something likeUPDATE sys.objects$ SET [name] =N'obsolete' WHERE [object_id] = {ye_olde_object_id}; {enter} GO {enter}
. Worth a shot..