Solved

SQL code to perform a the functions described in the body of this question

Posted on 2014-04-03
4
208 Views
Last Modified: 2014-04-10
Could somebody help with coding in SQL to perform the following...

check folder - \\cluster\data\Direxxis\Erie\incoming\
if there is a matrix file – eg. Erie_Creative_Matrix_20140403.xlsx
remove the date portion eg. _20140403
copy matrix file without the date portion to \\cluster\data\Direxxis\Erie\incoming\
    - but before changing the file name copy the original eg. Erie_Creative_Matrix_20140403.xlsx to
\\cluster\data\Direxxis\Erie\Archived_Incoming\CreativeMatrix

run dtsx (with new file name eg. Erie_creative_Matrix.xslx)
\\cluster\data\Direxxis\Erie\Programming\IMPORT_Erie_Creative_Matrix_STAGE.dtsx

Thanks in Advance
0
Comment
Question by:tesla764
  • 2
4 Comments
 
LVL 13

Assisted Solution

by:magarity
magarity earned 100 total points
Comment Utility
Isn't this sort of thing more suited to a DTS package?
0
 
LVL 9

Accepted Solution

by:
Sreedhar Vengala earned 400 total points
Comment Utility
This is can be acheived within your DTSX (SSIS) package.  You can have a pre-load process wherein you can use Script Component and write bit of C# code to read the designated Directory and check if there are any files which contains file name with work 'Matrics', if exists split on '_' and assemble back with appropriate name. And then copy to destination designated directory.

Further in next step you can load your data.
0
 

Author Comment

by:tesla764
Comment Utility
Hi Sreedhar,
  Could you tell me how to use the script component and give a working example of the c# code to read the designated directory to check for files have have the name "Matrix". And then the rest of the code you mentioned, if exists split on '_' assemble back with appropriate name and copy to designated directory.

Thanks
0
 

Author Closing Comment

by:tesla764
Comment Utility
Thanks.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
In this article I will describe the Detach & Attach 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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now