Error: [0] The column [CreatedDate] is not allowed in the WHERE clause of a replication
Issue Description
While filtering the History tables using the 'CreatedDate' column, an error occurred: 'Error: [0] The column [CreatedDate] is not allowed in the WHERE clause of a replication.'
Resolution
To filter data based on the CreatedDate column, follow these steps:
- Use the WITH Clause: Instead of the WHERE clause, use the WITH clause in your query.
- Specify Date Range: Define the range of dates using the ReplicationStartDate and ReplicationEndDate parameters to filter the data.
Example Query: To filter data from the LeadHistory table where the CreatedDate is between 2024-03-01 and 2024-05-30, use the following query:
REPLICATE [LeadHistory] WITH ReplicateStartDate = '2024-03-01', ReplicateEndDate = '2024-05-30' Select * FROM [LeadHistory]
Additional Notes:
- Ensure that the ReplicationStartDate and ReplicationEndDate parameters are set correctly to match your desired date range.
- This approach avoids the error related to using 'CreatedDate' directly in the WHERE clause during replication.