Posts

Showing posts with the label Data

SSIS - automatically setting Flat File columns data types

Image
Problem: Have a large number of (TSV) files that need to be imported (periodically) (via SSIS package) into existing MSSQL DB tables. Getting many data type issues from the  OLE DB Destination  tasks eg: [Flat File Source [2]] Error: Data conversion failed. The data conversion for column "PRC_ID" returned status value 2 and status text "The value could not be converted because of a potential loss of data.". and the type suggestions from the connection managers for each table from  Flat File Source  tasks are not accurate enough to prevent errors when running the import package (and the DB types are the correct ones, so don't want to just make them all (wrongly) strings for the sake of loading the TSVs). Is there a way to load the type data for the columns in some single file rather than one by one in the connection manager window for the  Flat File Source  tasks (this would be hugely inconvenient as each table may have many fields)? I have th...

SSIS - Casting DT_STR to DT_DECIMAL returns incorrect values

Image
Problem: I am using SSIS on VS 2015, and I make a test using OLE DB Source and OLE DB Destination (tables on SQL Server 2017). The problem is the Source table I have the one field varchar(10) type and the values is decimal´s (remember that this field is varchar(10). The values TB_ are: On Integration Services, I used OLE DB Source, Data Conversion and OLE DB Destination. On Data Conversion Component, I set the type to numeric (and decimal I tried after): On OLE DB Destination, I mapped the fields: But, when I execute the Package, The OLE DB Destination have the values: The correct values on CAMPO2 field will be 4.51, 20.5 and 98.54 The struct table OLE DB Destination is: Any Suggestions? Solution: Problem cause The main cause is the decimal seperator, the varchar column contains a comma  ,  instead of a point  . Experiments If we try to case the following text to decimal  "1,2"  the result is: 12.00 If we try ...