Open bartread opened 8 years ago
There's actually no need for this to use the custom WHERE clause query, so I'll workaround for now by switching to a standard AutoQuery. The fact that we have other custom WHERE clause queries elsewhere that work is odd though - it seems the fact that this only involves a single table may be the problem. Can't say for sure at the moment, obviously, but hopefully a test case will reveal all.
Also, weirdly, in this case it appears to have generated a WHERE
clause, using the correct alias, rather than use the custom WHERE
clause supplied. WTH?
And, weirdly, I can't reproduce this in a test. It works just fine, generating the expected SQL:
SELECT [r].[ProSupportRuleKey],
[r].[RuleMccCode],
[r].[Title],
[r].[Details],
[r].[AdditionalInformation],
[r].[Reason],
[r].[IsNoteRequired],
[r].[IsForFirstData],
[r].[IsForGlobalPayments],
[r].[IsForValitor]
FROM [app].[PRO_SUPPORT_RULES_LUT] AS r
WHERE r.[IsForFirstData] = @isForFirstData;
Here's the generated SQL:
Here's the code that results in the above FrankenSQL: