SSIS - automatically setting Flat File columns data types
Problem:
Original post: https://stackoverflow.com/questions/58176770/set-datatypes-for-ssis-connection-manager-object-other-than-manually-one-by-on/58191366#58191366
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 the creation statements that were used to create each of the tables that the TSVs correspond to, could that be used in any way? Can a
Solution:Flat File Source
inherent data types for columns from its OLE DB Destination
? Any other ways to avoid having to set each type by hand?
There is no difference between changing columns data type from the Flat File Source, and between keeping all data types as string and linking them to OLE DB Destination (different data types). Since both methods are performing Implicit Data conversion since flat file are text files and store all data as text (columns don't have metadata).
If you are looking to automatically set the data types, I don't think there is another way to do that other than the solution you mentioned in the comments or creating package programmatically(even I don't find it useful to do it that way).
Original post: https://stackoverflow.com/questions/58176770/set-datatypes-for-ssis-connection-manager-object-other-than-manually-one-by-on/58191366#58191366
Comments
Post a Comment