SSIS 2008 create new folder and copy - ssis

in SSIS 2008, In my incremental process, I would like to create automatically a new folder containing the current date.
Then copy all files from a source directoty to this new folder...
Any idea how to do that?
Thanks in advance
Largo

You can use "Execute Process" to run a robocopy .bat file to copy the files.
Create a local variable and assign it in a C# script to get the current date.
Dts.Variables["User::CurrentDate"].Value = DateTime.Now;
Found a easier way to add the date. follow the link
http://www.sqlnerd.com/ssis_dynamic_dates.htm

Related

SSIS Copy files task does not copy custom date column

Well, I am facing one weird issue with Copy Files task i SSIS.
I have folder A in which I have sub folders and I am using Copy files task to copy all the Excel files in sub-folders to the folder A. I noticed that with some of the excel files where I have custom date column which is restricted by list to select dates from as I don't want user to input wrong date/format.
When I run the package the excel file is copied but that date column is not getting populated.
I am not getting the reason why its happening.
Can some one help? What approach I should follow to resolve it?
So, what I did is in place of Copy file from the drop down of the component I selected move file and ran it once. And then again I ran with Copy command and it some how worked. I am not happy this though. I have put in a solution at the end of SSIS package where after the files are loaded to SQL table I am deleting them from the source folder using looping component.
For now it seem to be working. but exact reason for not copying the particular custom date field is still a question.

How to load data from csv file in ssis using for each loop container

Daily SQL Job will start at 12.00. It will run a package that fetch a CSV file from a folder(using for each loop container in ssis).
Suppose if there no files in that specific folder. You should not run the package until the csv files load into that folder? How we can do this using SSIS .
Please help me on this.
Have the job run on a schedule. If there are no files in the folder, it won't do anything. The next time it runs, if the files are there, it will process them.
Using a script task, you can check if the file exists in that location with that file extension and then build an expression in the precedence constraint editor. Set the evaluation operation to expression and constraint value to success. Something like the one shown in the screenshot below.

Force delete a file using SSIS on a network location

I am facing a problem while deleting a file on a network location using SSIS, since its a zip file, contains monthly SQL Database backup file, so I need to delete the last month file before copying current month file.
May be there is some app which were using this file, I am not sure, but I wanna get rid of this file, so that I can copy new file.
Thanks
Use a file task and you should be able to delete pretty much anything on any location as long as you have the rights to do so.

Is it possible to rename a directory in SSIS?

In SSIS is it possible to rename a directory? There is a requirement like copy a directory and paste it in a different location and rename it with current date.
Yes, this is possible in SSIS using the File System Task.
For detail and step by step visit this link.

SQLServer 2008 : Name of backup file

I have a SQL server 2008 and I would change the name of the backup file.
I use an SSIS package to perform my backups.
The file's name looks like
[DATABASE_NAME]_backup_YYYY_MM_DD_XXXXXX_XXXXXX
This is automatically generated by SqlServer, and I want to remove the "_".
How I can modify this ?
Thank you in advance,
Andy.
I have faced similar situation today and used following workaround.
Use "Execute Process Task" to rename the backup. I created a batch file with following command and executed it after the Database backup task.
ren BDNAME.bak DBNAME_%date:~-4,4%%date:~-7,2%%date:~4,2%.bak
Above command will rename DBNAME.bak file to DBNAME_yyyymmdd.bak
Keep the file in the same folder where you keep the backup file. In the Execute Process Task Editor, specify batch file name in the Executable property and the location of batch file in the WorkingDirectory property.
Hope it helps.
I believe that you can use the DestinationManualList for this, although I've never used it myself and I can't seem to find documentation or examples of it anywhere. It appears in the Properties list for the Backup Database Task, but not in the dialog for it.
I don't believe you can manual edit the DestinationManualList property. Right click on the task and select Edit. In the dialog that opens click on "Back up databases across one or more files" then click on the Add button. In the Select Backup Destination dialog click on File name and enter the path including the name and extension of the file. What you've entered will then show up in the DestinationManualList collection.