I have an application that creates and removes tables as part of its process. For some reason it doesn't always remove the tables it creates.
Running on SQL Server 2000 this does not create an issue, however I have upgraded to SQL 2005.
When I attempt to view the tables in Management Studio I receive an error "Value cannot be NULL" and no tables are displayed.
The following code displays the culprit:
SELECT TABLE_SCHEMA,TABLE_NAME, OBJECTPROPERTY(object_id(TABLE_NAME), N'IsUserTable') AS type FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA IS NULL
TABLE_SCHEMA TABLE_NAME type
--------------- ------------- ------
NULL GRSA0000002H5 NULL
How can I remove this table with a Table_Schema of NULL?
ALTER SCHEMA dbo TRANSFER NULL.GRSA0000002H5
UPDATE INFORMATION_SCHEMA.TABLES SET TABLE_SCHEMA = 'dbo' WHERE TABLE_SCHEMA IS NULL
as well as some code I found using 'sp_changeobjectowner'.
The response I get is either it doesnt exist or I dont have permissions.