I am trying to import data from a .csv file into SQL Server using DTS. the file contains data like this:
Name, Price
PROD1, 10.50
PROD2, 11.2
,0
,0
XYZ, 0
The table I am importing into has the "name" column set as not allowing null so the rows 3 and 4 are causing an error
I modified my transformation script to check for nulls but it still does not work, I get the error:
"Insert Error, Column 1('name', DBTYPE_STR) status 10, attempt to insert null data or data which violates integrity constrants."
What Am I doing wrong?
----------------------------------------------
Here is my code:
' Copy each source column to the destination column
Function Main()
If Not IsNull (DTSSource("Rate")) Then
DTSDestination("rate") = DTSSource("Rate")
End If
If Not IsNull (DTSSource("name"))Then
DTSDestination("name") = DTSSource("name")
End If
Main = DTSTransformStat_OK
End Function
Name, Price
PROD1, 10.50
PROD2, 11.2
,0
,0
XYZ, 0
The table I am importing into has the "name" column set as not allowing null so the rows 3 and 4 are causing an error
I modified my transformation script to check for nulls but it still does not work, I get the error:
"Insert Error, Column 1('name', DBTYPE_STR) status 10, attempt to insert null data or data which violates integrity constrants."
What Am I doing wrong?
----------------------------------------------
Here is my code:
' Copy each source column to the destination column
Function Main()
If Not IsNull (DTSSource("Rate")) Then
DTSDestination("rate") = DTSSource("Rate")
End If
If Not IsNull (DTSSource("name"))Then
DTSDestination("name") = DTSSource("name")
End If
Main = DTSTransformStat_OK
End Function