Note that there are some explanatory texts on larger screens.

plurals
  1. POMethod in SSIS to transform flat file data (based upon scalar sql functions)
    primarykey
    data
    text
    <p>Initially, I put together a TSQL script to bulk import data from a set of flat files. (see below). Using functions in SQLSERVER it was easy to convert the data to the datatypes I want and to handle transforming the data based upon whatever unique conditions I might encounter with the data set. For example, all columns could have spaces at the beginning or end, the date columns that represent null values are of a specific value, the data that is money can have a dash at the end of the number representing a negative number, etc. So I use the scalar-valued functions in sqlserver to handle the various conditions and case statements to allow a consistent data set.</p> <p>My goal now is to migrate this to SSIS, but it seems extremely cumbersome to replicate what I have already done within SSIS. While SSIS does have tools to do the transforms (like the character map, data conversion, derived column tools, and script component). -- it seems a massive amount of work to get what I already had in my script. It doesn't appear that I can re-use anything. While that might be OK for a small table, keying in the same complex tranformations for 50+ columns per table is really going to be a chore -- and then to maintain that if I need to modify something? uggh. I must be missing something. Thanks for your help.</p> <pre><code> INSERT INTO [TEST1].[dbo].[Table1] SELECT dbo.TRIM([ID]) ,dbo.FixDate([CompleteDate]) ,dbo.TRIM([IsDeleted]) ,dbo.Text2Numeric([QtyTotal]) ,dbo.Text2Numeric([OrderQty]) ,dbo.Text2Money([Price]) FROM OPENROWSET(BULK '\\server1test\temp\import1.txt', FIRSTROW=2, FORMATFILE='\\server1test\temp\import1.Xml' ) as t1 ; GO </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COWithout seeing what you've done for your UDFs, I don't think anyone would be able to say with any substance what your final solution would look like within SSIS. You are most likely looking at recoding your TSQL logic into the appropriate construct in SSIS. Based on the apparent complexity, I'd look at script component. If re-use is a crucial decision point, I would look at encapsulating your logic into a signed DLL and deploying that into the ETL server's GAC and referencing that from within a script task. SSIS should give you more traceability for skunky data over openrowset.
      singulars
    2. COI could post the functions, but I'm not looking for help with my specific functions, but on how to handle this general problem. Doing the transform as described above using a function is so easy -- and if I need to change something I just change the function and it applies to everything that uses it. I don't see an equivalent in ssis and I am hoping I am wrong.
      singulars
    3. COThe script component did seem like the best way to go -- but there again; I would need to apply that component to many different transforms; basically the same transform or set of transforms to lots of different tables. And there again; the maintainability of that seems a bit fragile.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload