Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
brendalisalowe
Constraint Violating Yak Guru
269 Posts |
Posted - 2005-05-25 : 16:01:13
|
I have a DTS package that creates an Excel file once a month for my boss. I was just wondering if there is a way to dynamically name the file using a the GETDATE() function or something? Right now I just have this:\\M\SharedDocs\HUD\OriginalDataBut can I do this:\\M\SharedDocs\HUD\GETDATE()& OriginalDataor something like that?Thanks!BrendaIf it weren't for you guys, where would I be? |
|
SreenivasBora
Posting Yak Master
164 Posts |
Posted - 2005-05-25 : 17:47:38
|
Hey,Please notice that, in my code we are not going to change the original Excel file, we need to create a new file with YYYYMMDD_SAMEFILENAME.xls Just try this:Dont do any modification to your package, just select "ActiveX Script Task Proeprties"write below code...Function Main()Dim sFile, sDt, sTime, sFinalPath sPath = "c:\Temp\" sFile = "OriginalData.xls" sDt = Replace(Replace(Replace( now(), ":" ,"") , "/","")," ","") sFinalPath = sPath & sDt & "_" & sFile Dim oCD : Set oCD = CreateObject("Scripting.FileSystemObject") oCD.CopyFile sPath, sFinalPath Main = DTSTaskExecResult_SuccessEnd FunctionWith RegardsSreenivas Reddy B |
 |
|
brendalisalowe
Constraint Violating Yak Guru
269 Posts |
Posted - 2005-05-25 : 18:36:28
|
Thanks. Cool!BrendaIf it weren't for you guys, where would I be? |
 |
|
|
|
|
|
|