Datetime conversion problem in SQL Server

Viewed 62

I have a flat file with the following format as datetime

5/3/22 2:09:02 PM (MM/DD/YY HH:MM:SS) but it gets read in SQL Server as 2022-03-05 14:09:02. I have used SSIS ETL to load the flatfile to DB.

How to fix this error? I was supposed to get 2022-05-03 14:09:02 in SQL Server. Suggest me the datatype as well

1 Answers

This is a locale problem. It looks like your flat file has its dates encoded according to the American method and your database default locale is set to some European method.

When you set up your SSIS job, pick an American locale (US English will work) in the flat file connector properties panel. Then SSIS will handle your input date/time values the way you want.

Related