SSIS 2012 : work around for missing milliseconds in SSIS datetime variable+ Solution for incremental load using datetime column
In many cases for incremental load we will consider datetime column . when we want to implement incremental load based on datetime column in SSIS we should be very careful because the milliseconds will be truncated in SSIS datetime variable . In This case we will face issue if the data is in milliseconds also .
Workaround : To avoid this milliseconds issue create variable sof string instead of Datetime and load the value using the fallowing query
select CONVERT(VARCHAR(23), max(LastUpdated), 121) as MaxLastUpdated from [Schema].[OPS_CDR_Scrapper_Data]
and
use that varible in OLEDB source like below
select FileName, Folder, LastUpdated from scraper_log_file_details
where LastUpdated > CONVERT(DATETIME, ?, 121)
and map the parameter .
Workaround : To avoid this milliseconds issue create variable sof string instead of Datetime and load the value using the fallowing query
select CONVERT(VARCHAR(23), max(LastUpdated), 121) as MaxLastUpdated from [Schema].[OPS_CDR_Scrapper_Data]
and
use that varible in OLEDB source like below
select FileName, Folder, LastUpdated from scraper_log_file_details
where LastUpdated > CONVERT(DATETIME, ?, 121)
and map the parameter .
You just saved me a lot of rework! Thanks!!!
ReplyDeleteyou are welcome
DeleteThank you, but I am getting very very slow performance. Are you facing same ?
ReplyDeleteHi Gaurav, we are not facing any performance issue , do you have index on datetime column ?
DeleteVery helpful! Helped me resolve my problem in 5 minutes. Thank you.
ReplyDeleteExcellent! Thanks!
ReplyDelete