Perfect! It works...
But now, I'm facing another question, about the detection method of the non-unique AK.
In the reject template, it's written:
where exists (select 'X'
from %x{md:physicalPath($REF,'checkedName')}x% %x{$REF/ref:target()/tech:tableAliasWord()}x% E
where %x{md:patternList($REF/ref:columns()[if ($REF/tech:rejectMode()='S') then tech:isPK() else tech:isUK()],'C.[COL_NAME]\t= E.[COL_NAME]', '\n\t\t\t\tand\t')}x%
group by %x{md:patternList($CONSTRAINT_REF/ref:columns(),'E.[colName]', ',\n\t\t\t')}x%
having count(*) > 1
)
After compilation:
where exists (select 'X'
from [database].[schema].[myTable] as E
where C.[pk_column] = E.[pk_column]
group by E.[ak_column]
having count(*) > 1
)
If I vulgarize, it means the query wants to "look for non-unique ak_column
per pk_column".
But if my pk_column is unique, there won't never be any duplicate values on ak_column... Am I wrong?
I have checked that with my data:
myTable contains some non-unique values on "ak_column".
But the template does not detect any rejects.
Maybe I have an idea about what query would do the job... But I have to try it before.
My idea: not using an "exists", but an "inner join" with quite the same subquery (which detects duplicate values).
To be continued...