active x in dts

  • if i wish to save the contents of a table to a folder on a network, and i want to include the current date in the name of the text file being saved to the folder? how would i write the script?

     

    it iwant to save to :c:\myfile020405.

    where myfile is the name of the folder and

    020405 is the curent date at the time of the transfer?

    also any good sources on where to learn vb script to use in active x/

     

    thanks

    [font="Comic Sans MS"][/font]It is what it is.

  • This was removed by the editor as SPAM

  • The simplest DTS package I can come up with has a global variable, three tasks, and and two connections.  In order they are:

    Declare a global variable for the filename.

    1. ActiveX Script Task

    2. Dynamic Properties Task

    3. MS OLEDB Connection

    4. Data Pump Task

    5. Text File (Destination) Connection

    When you first set up the Text File (Destination) and Data Pump Task, Text File and Data Pump Task destination file names are unimportant.

    Now do the following steps:

    1. Select the source table in the Data Pump task.

    2. In the ActiveX Script Task set the global variable:

    DTSGlobalVariables("DestFileName").Value = "C:\MyFile" & _

       CStr(Year(Now)) & _

       Right("0" & CStr(Month(Now)), 2) & _

       Right("0" & CStr(Day(Now)), 2)

    3. In the Dynamic Properties Task set the Text File (Destination) connection's DataSource property to the global variable.

    4. In the Dynamic Properties Task set the Data Pump Task's DestinationObjectName property to the global variable.

    Now, when you execute the package a text file with the name MyFileYYYYMMDD will be created.  I realize the date is not the same format as your original post, but I like to use this format because it automatically puts the files in date order when listing them.  You can change the date format to whatever you like in step 2.

     

  • Thanks soo much that did it. thank you thankyou

    [font="Comic Sans MS"][/font]It is what it is.

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

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