BUG - SQL 2008 DB Names Containing Control Characters

by jfisch 1. October 2010 07:03

Createc Connect Bug for an issue caused by a Visual Studio dialog adding a ASCII 127 character to a database name.

https://connect.microsoft.com/SQLServer/feedback/details/608963/database-names-containing-control-characters

You can't tell the difference between the names within Management Studio.

Vote for it if you like.

Tags: ,

SQL | SQL CLR

The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DatabaseName'.

by jfisch 5. June 2009 13:48

I've ran into this several times myself and each time I after to search through some forum posts for the solution.  So, here it is since I'm tired of searching for it myself.

After having restored a database from a backup that contains a SQL CLR functions I always have to perform a number of steps to re-enable the database to be able to perform SQL CLR functions within it.  One of the specific errors received upon attempting to CREATE ASSEMBLY after having restored the database is the error "The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DatabaseName'. You should correct this situation by resetting the owner of database 'DatabaseName' using the ALTER AUTHORIZATION statement."  This error is received by attempting CREATE ASSEMBLY prior to resolving the SIDs using sp_changedbowner.  I've decided to outline the number of steps that I move through to resolve the SQLCLR references upon restoration of a database ONFIGURE

GO

 

ALTER DATABASE [DATABASENAME] SET TRUSTWORTHY ON

GO

 

DROP FUNCTION [dbo].[SQLCLRFunction]

 

CREATE FUNCTION [dbo].[SQLCLRFunction] (@Blah nvarchar(4000))

RETURNS nvarchar(4000)

AS EXTERNAL NAME [SQLCLRFunction.Assembly].[SQLCLRClass].[SQCLRFunction];

Tags: , , , ,

Development | SQL CLR

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen