{"name":"Untrusted check constraints","description":"<p>The number of check constraints that have their is_not_trusted flag set to 1 in the sys.check_constraints table.<\/p>\r\n<p>If untrusted check constraints exist, find out which ones they are by running:<\/p>\r\n<pre class=\"sql\">SELECT * FROM sys.check_constraints WHERE is_not_trusted = 1 AND is_not_for_replication = 0<\/pre>","tsql":"\/*get the current database name*\/\r\nDECLARE @DBName VARCHAR(500)\r\nSELECT @DBName = DB_NAME()\r\n\r\n\/*set the tsql to be executed in a variable as it needs to be combined with the @DBName variable *\/\r\nDECLARE @strSQL VARCHAR(200)\r\nSET @strSQL = 'SELECT COUNT(*) FROM [' + @DBName + '].sys.check_constraints WHERE is_not_trusted = 1 AND is_not_for_replication = 0' \r\n\r\n\/*execute the tsql*\/\r\nEXEC (@strSQL)\r\n","instances":true,"frequency":86400,"databases":{"mode":0},"rateofchange":false,"metricenabled":true,"alertname":"Untrusted check constraints","alertdescription":"<p>This alert is raised when SQL Monitor detects check constraints that have their is_not_trusted flag set to 1 in the sys.check_constraints table.<\/p>\r\n<p>To find out where untrusted check constraints exist, run:<\/p>\r\n<pre class=\"sql\">SELECT * FROM sys.check_constraints WHERE is_not_trusted = 1 AND is_not_for_replication = 0<\/pre>","aboveorbelow":"above","collections":1,"alertenabled":true,"_thresholds_high":{"selected":true,"value":0},"_thresholds_medium":{"selected":false},"_thresholds_low":{"selected":false},"targetentitytype":0}