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

UK dates in a tab delimited file being imported incorrectly as US dates via SSIS import wizard.

$
0
0

I have a range of some 40 tab delimited txt files to load into a SQL Server 2008R2 database. These range in size from 2k to 14GB. Dates in these files are in the DDMMYY, DDMMYYYY, DD/MM/YY, DD/MM/YYYY (or YYYYMMDD being imported as varchar) format. Some columns can have a mixture of 2 and 4 digit years.

The box on which SQL Server has been installed I've now had confirmation is all UK (I'm in the UK, the box is in the UK, the data is all UK data and we are a UK organisation), including localisation/locale. I cannot change this on this pre production environment anyway. Originally when they set up the SQL instance they defaulted it all to US and I had to change it to British English.

All the receiving tables have been created with the correct data types set. Dates have been set to datetime.

When using SSIS to import the data (I can only use SSIS for operational reasons), the dates are incorrectly imported. Originally I thought converting to a US date format but further investigation shows many inconsistencies.

If I bring the date data in as say varchar and then query the table and validate using the isdate function SQL Server returns 1 as a valid UK date. If I alter the table and add a date column and update the new column the dates are converted correctly.

I have also tested this process on two other environments (both of which I configured personally from scratch some time ago) and I can not replicate this issue with the test data I have.

Interestingly, when using the SSIS wizard on my machines the Locale defaults to English (United Kingdom). On the their machine it defaults to English (United States) and I have to change the locale manually to be UK

We have also checked the default user in the registry and this is set correctly too.

So (finally) my questions are as follows:-

Why can't SSIS correctly convert the dates to the UK date format on this instance? Why does it think it needs to convert it to US or derivative thereof? What settings need to be changed?

How can I get SSIS to import the data correctly or am I going to have to use the subsequent update method described above (ie; load as varchar and then add columns and update those)

I can provide a sample data file, sample table structure and screen prints if requested.

Many thanks in advance.

John


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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