Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-04-03
4
Medium Priority
?
218 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 200 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 800 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
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…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

886 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