MCITP

MCITP

Tuesday, September 11, 2012

How to check trustworthy property of the databases

The TRUSTWORTHY database property is used to indicate whether the instance of SQL Server trusts the database and the contents within it.


select  name,is_trustworthy_on from sys.databases

This will let you know if trustworthy property is enabled/disabled for all database.

If you want to set trustworthy property On the use the below command on the required database.


ALTER DATABASE DatabaseName set TRUSTWORTHY ON

If you want to set trustworthy property ON for all database in SQL SERVER except the system databases then please use the below command.

DECLARE @command varchar(1000)

SELECT @command = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'') BEGIN USE ? EXEC(''ALTER DATABASE ? set TRUSTWORTHY ON '') END '

EXEC sp_MSforeachdb @command

1 comment:

Followers