开发者

How to write extract Row Count to Trailer record in flat output file

I used the Transformation object "Row Count" to capture the number of rows written to an external flat file and now I want to add a Trailer record to that file.

Currently, I append a Traielr record to the same file by essentially reexecuting the SQL that I used to extract the Detail records and then counting the rows returned, something like this:

SELECT 
    'T' AS TLR_REC_TYPE,
    TLR_NBR_RECORDS = (
        SELECT Count(1) + 2 --Include Header row and this Trailer row in count
          FROM   
        (***=Insert SQL used to query Detail records here***)
     )

I am trying to use teh RowCount transformatiobn 开发者_JAVA技巧obejct for the first time. I believe I have it set up where the Detail rowCount is now in a user Variable. How do I write this user Variable to the trailer record so the Trailer row has the format:

T,{RowCount}


Add a derived column that references the user variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜