Solved

I am importing a .csv file comma delimited to sql2008r2 and 2 of the columns are datebase timestamp.  Some of the rows contain the value NULL .

Posted on 2014-10-24
2
286 Views
Last Modified: 2016-02-11
I am importing a .csv file comma delimited to sql2008r2 and 2 of the columns are datebase timestamp.  Some of the rows contain the value NULL and I receive the following error: "Error Data  conversion failed.  The data conversion for column "START_DTE" returned status value 2 and status text"  The value could not be converted because of a potential loss of data".

Copy of the .csv record and the 2 NULLs before the datetime fields are START_DTE and END_DTE and in the table these are also database timestamp:

98-017 (Use),All of the warehouse,NULL,NULL,NULL,2014-08-14 00:00:00.000

I have saved this to SSIS and included a screen shot.
Doc2.docx
0
Comment
Question by:wdbates
2 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
Comment Utility
Two ways to resolve this:

1.

(My preferred) Contact the source of this .csv file, and after a good smacking tell them to remove the NULL values from the file, and replace them with an empty string, e.g. ,2014-01-01, changes to ,,

2.

If the above is not possible, in your SSIS package change the destination to be a staging table (I prefix these with ssis_ or timp_) that is all varchar values, and pump the file data into it.  Then run T-SQL to remove the NULLs, and do other data validation checks such as dates are dates, numbers are numbers, etc.  Then do an INSERT to move that data into your final destination table.

Also a good idea to gracefully handle any rows that fail these validation checks.
0
 

Author Closing Comment

by:wdbates
Comment Utility
Thanks Jim.  

That did the trick!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In couple weeks ago, I encountered an extremely difficult problem while deploying 2008 SSIS packages to a new environment (SQL Server 2014 standard).  My scenario is: We have one C# application that is calling 2008R2 SSIS packages to load text fi…
Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now