Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Rename File in SSIS Expand / Collapse
Author
Message
Posted Thursday, September 4, 2008 2:17 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, May 5, 2009 3:35 PM
Points: 12, Visits: 27
use a VB Script to change the file name. I use the below script to do that exact same thing to an excel export from a OLE DB Source

Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime

Public Class ScriptMain

' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.

Public Sub Main()
Dim mydate As Date
Dim ExportFileName As String
mydate = DateAdd(DateInterval.Day, -1, System.DateTime.Today)
ExportFileName = "c:\" + "T" + mydate.ToString("yyyyMMdd") + ".xls"
Dts.Variables("ExportFileName").Value = ExportFileName
Dts.TaskResult = Dts.Results.Success
End Sub

End Class
Post #564162
Posted Thursday, April 30, 2009 11:17 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, April 20, 2012 6:54 AM
Points: 12, Visits: 86
Hi, when I try to do this with the time I get the same error but when I leave the time off and only use the date it works fine? Any ideas?
Post #707862
Posted Tuesday, September 15, 2009 1:09 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, October 15, 2010 11:32 AM
Points: 47, Visits: 35
Thanks, I was looking for the answer as well.

Any idea on how to make the month two digits (ie '09') instead of just 1 ('9')?
Post #788476
Posted Monday, March 24, 2014 4:39 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, June 6, 2014 8:44 AM
Points: 3, Visits: 24
I have the same error for my SSIS package using the File System Task.
It returns this error :
[File System Task] Error: An error occurred with the following error message:
"The given path's format is not supported."

Steps done:
I checked my variables and find out that my destination file has a special character which is not allowed in excel filenames.
Therefore, we still need to check the filename itself :)
In my case, I removed colon (:) in my filename and it works like a charm!

Post #1553948
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse