When installing the tSQLt framework on a chosen database, in some cases the following warning message can be shown:
There is more than one solution to this issue. Here will be explained the two most common.
The first solution is already suggested in the raised message. In order to alter the authorization on the specific database, execute the following alter authorization statement against the database in question:
DECLARE @Command VARCHAR(MAX) = 'ALTER AUTHORIZATION ON DATABASE::[>] TO [>]' SELECT @Command = REPLACE(REPLACE(@Command, '>', SD.Name), '>', SL.Name) FROM master..sysdatabases SD JOIN master..syslogins SL ON SD.SID = SL.SID WHERE SD.Name = DB_NAME() PRINT @Command EXEC (@Command)
After this, the tSQLt framework should be installed in the chosen database without any issue.
The second solution has two steps. The first step is to map the specific user to the master database in SQL Server Management Studio. To do that, go to the Object Explorer pane, expand the Security node, then the Logins node. Navigate to the specific login and right-click on it. From the context menu, choose the Properties command:
Go to the User Mapping tab and tick the master database:
By default, the login user name will be added to the master database. Click the OK button.
The second and final step of this solution is to run the following script:
EXEC sp_changedbowner ''
After applying either of the above-listed solutions, the tSQLt framework installation on the chosen database will result in this message:
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Conditions d’utilisation Confidentialité Cookie Preference Center