Export .CSV files to specific locations

  • Here is the table that contains the data that I need to export.

    IF EXISTS

    (

    SELECT *

    FROM sys.objects

    WHERE object_id = OBJECT_ID(N'[dbo].[sectxt_tbl_Intex_to_Securities_OUTPUT]')

    AND type in (N'U')

    )

    DROP TABLE [dbo].[sectxt_tbl_Intex_to_Securities_OUTPUT]

    SELECT

    DEAL_NO,

    DEAL_NAME,

    IDEALNAME,

    LOAN_ID,

    loan_no,

    ILOAN_ID,

    group_no,

    datatype,

    FileListPeriod

    INTO sectxt_tbl_Intex_to_Securities_OUTPUT

    FROM vwUniverseForOutput

    ORDER BY

    datatype,

    group_no

    I need to create several .CSV files and output them to an FTP site. The folder structure of the FTP site goes like this:

    datatype1

    Period1

    Group1

    Group2

    ...

    Period2

    Group1

    Group2

    ...

    datatype2

    Period1

    Group1

    Group2

    ...

    Period2

    And so on. I don't even know where to begin on this one. And to make matters worse, there is no limit on how many periods or groups there are.

    HELP!!!

  • Okay, I've figured out a way to concatenate the columns into a destination folder string. The code looks like this:

    SELECT

    DEAL_NO,

    DEAL_NAME,

    IDEALNAME,

    LOAN_ID,

    loan_no,

    ILOAN_ID,

    group_no,

    datatype,

    FileListPeriod,

    '\' + cast(datatype as varchar) + '\' + cast(FileListPeriod as varchar) + '\' + cast(group_no as varchar) AS DestinationFolder

    FROM dbo.sectxt_tbl_Intex_to_Securities_OUTPUT

    WHERE

    datatype = 'ABS'

    OR datatype = 'ALT-A'

    Now how can I take that string and use it to direct SSIS to create a file at that location?

  • Now that I have the DestinationFolder, perhaps there is an object in SSIS 2005 that can generate (or commit) a new .csv file based on a change in the value of the DestinationFolder in the previous message?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply