anchor.diff:    ;<%= validation.common_table_expression %> SELECT @Ignored = 1 WHERE EXISTS (<%= validation.invariant_negative_sql %>)
     IF (@@ERROR != 0 OR @@ROWCOUNT != 0)
     BEGIN
  -    INSERT INTO @FailedConstraintChecks(SchemaName, TableName, ConstraintName)
  -      VALUES ('<%= data_module.sql.schema %>','<%= object_type.sql.table_name %>','V_<%= validation.name %>')
  +    INSERT INTO @FailedConstraintChecks(SchemaName, TableName, ConstraintName, ViewSQL)
  +      VALUES ('<%= data_module.sql.schema %>','<%= object_type.sql.table_name %>','V_<%= validation.name %>','<%= "#{validation.common_table_expression}#{validation.invariant_negative_sql}".gsub("'","''") %>')
     END
   <%
      end
  
positive.code:   (
      SchemaName VARCHAR(500),
      TableName VARCHAR(500),
      ConstraintName VARCHAR(500)
    );
  <% data_module.object_types.select{|object_type| !object_type.abstract?}.each do |object_type| %>
  <%
  
negative.code: GO
  
  CREATE PROCEDURE <%= data_module.sql.schema %>.spCheckConstraints
  AS
  BEGIN
    SET NOCOUNT ON;
  