SQL to Excell

  • Hi, I need to export data out to an Excell spreadsheet on a daily basis. The format will not change. Here's the thing, the file name should be "daily_" and the date. Does anyone have any thoughts along this line?

    Thank you

  • Create a DTS package and use Active Scripting in the package to build the Excel file with the right name. Then using ADO populate it from the data source.

    There was an example either in an artilce or another thread on this site. But if you cannot find what you need just post here for more help.

    Edited by - antares686 on 12/10/2002 7:23:52 PM

  • Heres some sample ActiveX code that I used for changing an Access DB connection, but you could easily use it for your Excel connection:

    'Rename the destination Access DB to the one we want!

    'Declare variables

    dim oPackage, cn

    'Get a handle to the Package object.

    set oPackage = DTSGlobalVariables.Parent

    'Get a handle to the desired Connection

    Set cn = oPackage.Connections("My Access Connection")

    'Rename the source file to the new one

    cn.DataSource = "newdbname.mdb"

    Simply change the above DataSource connection with a date format. ie DateValue or Day, Month & Year

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

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