Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

How to filter based on where condition of CDC data from oledb data source SSIS

$
0
0

Hi,

We are using the CDC for ETLs. so we are taking the changed data and Moving. Here is an example.

so here is my SQLCommand. 

SELECT 
	cast(sys.fn_cdc_map_lsn_to_time(__$start_lsn) as date) as [start_date],
	cast(sys.fn_cdc_map_lsn_to_time(__$end_lsn) as date)  as [end_date], 
	customer_id, 
	client_id, 
	social_id, 
	provider_id, 
	lead_id, 
	type_gender_code, 
    type_customer_code, 
    type_transaction_code, 
    lead_type_code, 
    first_name, 
    prefix_name, 
    middle_name, 
    last_name, 
    suffix_name, 
    birth_date , 
    address1, 
    address2, 
    city, 
    state,  
    distance_from_dealer 
   
FROM            
	cdc.customer_customer_CT
where
	(
          cast(sys.fn_cdc_map_lsn_to_time(__$start_lsn) as date) >= ? and 
	      cast(sys.fn_cdc_map_lsn_to_time(__$start_lsn) as date) <=  ?  
     ) and
     (
               CONVERT(time,sys.fn_cdc_map_lsn_to_time(__$start_lsn))  >= ? and
	           CONVERT(time,sys.fn_cdc_map_lsn_to_time(__$start_lsn)) <= ?
      ) and
      __$operation in (2,4) 

so based on Date and Time we are moving the data.

everything works fine if i Do not add the  where condition to it. If I add where condition to it. Its showing that invalid character value to cast.

how to cast the date and time in where condition of SQL command in SSIS.

Thanks.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>