After application of CU3 for SQL Server 2012 I now receive conversion errors with simple business rules that use date comparisons. This could be related to the fix for blank values in CU3??
I was able to reproduce this with a very simple entity.
BrDateTest
Add two date/time attributes, FromDate and ThruDate.
Add a single business rule.
Condition
ThruDate is not equal to Blank
Action
ThruDate must be greater than FromDate
Add member to the entity and set the ThruDate to a value < FromDate and the conversion error happens.
After tracing it looks like the dynamically created procedure to check the rule is comparing attributes that are "datetime2" to string values that are not datetime values hence the conversion errors.
Here are the important bits..
Procedure - [mdm].udp_SYSTEM_14_1298_CHILDATTRIBUTES_ProcessRules
CREATE TABLE #BRMemberData
(
[MemberID] INT NOT NULL PRIMARY KEY CLUSTERED
,[OriginalCode] nvarchar (250) Collate database_default NULL --Needed later for processing of staging.
,[ChangeTrackingMask] INT NOT NULL
,[Code] nvarchar (250) Collate database_default NULL
,[FromDate] datetime2 NULL
,[ThruDate] datetime2 NULL
);
-- Error is caught on this next comparison
UPDATE #BRConditionEvaluation SET
IsConditionTrue = CASE BusinessRuleID
WHEN 1873 THEN CASE WHEN ((( md.[ThruDate] IS NOT NULL AND md.[ThruDate] <> N'~NULL~' ))) THEN 1 ELSE 0 END
END --case
FROM #BRConditionEvaluation AS ce
INNER JOIN #BRMemberData AS md ON (ce.MemberID = md.MemberID);
That comparison of md.[ThruDate] <> N'~NULL~' causes the issue.
Is this a known issue and are there any work arounds for this other than excluding or deleting these business rules?
Any help would be appreciated.
SQL Server Version
Microsoft SQL Server 2012 - 11.0.5556.0 (X64)
Oct 31 2014 16:50:24
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
Master Data Services Version 11.0.5556.0
Sincerely,
ML