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 .

Comments

  1. You just saved me a lot of rework! Thanks!!!

    ReplyDelete
  2. Thank you, but I am getting very very slow performance. Are you facing same ?

    ReplyDelete
    Replies
    1. Hi Gaurav, we are not facing any performance issue , do you have index on datetime column ?

      Delete
  3. Very helpful! Helped me resolve my problem in 5 minutes. Thank you.

    ReplyDelete

Post a Comment

Popular posts from this blog

SSAS : A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running. (Microsoft.AnalysisServices.AdomdClient). + Solution

SSIS Error : Unable to infer the XSD from the XML file. The XML contains multiple namespaces