Solved

SSIS script task

Posted on 2008-10-08
5
328 Views
Last Modified: 2013-11-10
I need to copy file  and add today's date to the file copied.. I added this code to script task in SSIS and it wasnts me to do Dim oFso as ..help..can someone check the code below

Dim oFSO            
Dim sSourceFile
Dim sDestinationFile
 
Set oFSO = CreateObject("Scripting.FileSystemObject")
sSourceFile = "c:\Customer\Customerinfo.xls"
sDestinationFile = "c:\Customer\CustomerInfo& (cstr(month(date)) & "-" & cstr(day(date)) & "-" & cstr(year(date))) & ".xls"
 
oFSO.copyFile sSourceFile, sDestinationFile
 
Set oFso = Nothing
 
0
Comment
Question by:ohemaa
  • 3
  • 2
5 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 22671973
You don't need to use FSO.  instead, import System.IO into your script, then use the following code to modify the files name:

System.IO.File.

it should pop up a list of methods available to use.
0
 

Author Comment

by:ohemaa
ID: 22672327
how do I do that pls? I am new to this stuff
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 22672424
open the script task, go to design script, and at the very top, add this:

Imports System.IO
0
 

Author Comment

by:ohemaa
ID: 22673153
can you explain.. if I do not use fso.  what do i use to copy the file from source to destination? like this
oFSO.copyFile sSourceFile, sDestinationFile
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22673173
you can do this:

 System.IO.File.Copy(sSourcePath, newName, True)
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question