Exporting to file with current date

  • Hello All,

    Can someone guide me how to achive this?

    Requirement is : To backup a table to a file named as filename_currentdate.txt .This is to be done using ssis package which is called from a job.

    Thanks in advance!!

    Regards

    Sanat

  • You would use a DataFlow transform to extract the table data. The Destination Connection string would be composed dynamically using an expression. The expression would use a variable. The value of the variable would be set using a Script Task.

  • Sanata Kumar Nayak (4/1/2008)


    Hello All,

    Can someone guide me how to achive this?

    Requirement is : To backup a table to a file named as filename_currentdate.txt .This is to be done using ssis package which is called from a job.

    Thanks in advance!!

    Regards

    Sanat

    Look here and download the dtsx from here[/url]

    Look up here as well just in case.

    There is a piece of VB.NET code in the script before you dataflow task, which fixes the query and the destination connection string, which looks like this:

    Public Sub Main()

    Dts.Variables("sTableQuery").Value = "select * from [" & CType(Dts.Variables("sTableName").Value, String) & "]"

    CType(Dts.Connections("CSVFile"), ConnectionManager).ConnectionString = CType(Dts.Variables("sCSVDir").Value, String) & CType(Dts.Variables("sTableName").Value, String) & ".txt"

    Dts.TaskResult = Dts.Results.Success

    End Sub

    where sTableQuery is used by the source and CSVFile is the destination connection.

    Add the date to there and you are done!!!

    Cheers,

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

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

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