Solved

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

Posted on 2014-04-03
4
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Assisted Solution

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

Accepted Solution

by:
Sreedhar Vengala earned 400 total points
ID: 39976918
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
ID: 39978138
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
ID: 39992790
Thanks.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

617 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