| |
Jeff_York
Posts: 1
Score: 0
Joined: 12/13/2004
From:
Status: offline
|
Good afternoon- THe following is part of a DTS package. What I am trying to do is to rename a file that uses the result of a DB Query as a part of the rename. I am having some difficulties, If anyone can point me in the right direction I appreciate it. Here is the relavant part of the script: Dim FileDate Dim DateString Dim FSO Dim File Dim RouteDate Dim oCon Dim oRS Dim sSQL Set oCon = CreateObject("ADODB.Connection") oCon.Open "Driver={SQL Server};" & _ "Server=rdoesql;" & _ "Database=eqsavers;" & _ "Trusted_Connection=yes" sSQL = "Select INV_Date From CTRL_DATE Where CTRL_NAME = 'INVDT'" Set oRS = oCon.Execute(sSQL) If Not oRS.EOF Then RouteDate = oRS(INV_Date) FileDate = Date DateString = DatePart("yyyy",FileDate) & Right("0" & _ DatePart("m",FileDate), 2) & Right("0" & DatePart("d",FileDate), 2)& RIght("0" & DatePart("h",Now),2) & RIght("0" & DatePart("n",Now),2) & Right("0" & DatePart("s",Now),2) Set FSO = CreateObject("Scripting.FileSystemObject") FSO.CopyFile "\\Irv_Server\EqSavers\CSCExport.txt", "\\Irv_Server\EQSavers\Archived_Exports\" Set FSO = CreateObject("Scripting.FileSystemObject") Set File = FSO.GetFile("\\Irv_Server\EqSavers\Archived_Exports\CSCExport.txt") File.Name = "CSCExport" & DateString & RouteDate & ".txt" End If
|
|