Support Questions

Find answers, ask questions, and share your expertise

Change Sqoop's Date Format in Incremental Import from SQL Server

TL;DR - Is it possible to change the date format Sqoop uses?

I am importing data (several views) from SQL Server using Sqoop (version 1.4.6) and am specifying a datetime column as my --check-column. Sqoop is querying the database using dates in the format yyyy-MM-ddd hh:mm:ss.SSS. However, since SQL server is configured to use British dmy date format, it, counterintuitively, interprets a date beginning with a year as having the day in the second position rather than the month (wtf?!).

E.g SELECT ... WHERE modified < '2017-01-31 00:00:00.000' is interpreted as selecting the data where modified is less than the 1st day of the 31st month 2017 which obviously throws an error.

Is it possible to change the date format Sqoop uses?


@Breandán Mac Parland

Think the other way around. Change the SQL server date using FORMAT. It should work in sqoop.

Hope it Helps!!

Cheers Bala, but I'm not sure I follow (I had a typo in my original question which might have cause some confusion). My problem is that Sqoop is generating queries with the date format mentioned, but I can't find a way to change the format it uses. Are you suggesting I change the date in the view to another format so that the query Sqoop generates will work? (e.g. I think datetime2 would work, but unfortunately it's much more difficult to get sql server changes as other applications/people are using it)