Scenario:
We get the files from our client that we need to load on daily basis to SQL Server Table. Sometime there are chances that the client might provide the same file again. In that case we want to move that file to Rejected Folder and don't want to load. If any new file will be received in the folder, we will load that after confirming the file is not loaded already.What you will learn in this video
- How to read the files from Folder by using For-each Loop Container
- How to Log the file name into the SQL Server Table for validation
- How to Check if file is already loaded. You will build your query in Execute SQL Task by using Expressions
- How to use File System Task to move file from Source To Reject Folder in SSIS Package
- Move the new file to Archive folder after loading first time by using File System Task.
Script used in the video to handle already loaded files to move to RejectFolder and Load New Files in SSIS Package
--Create FileLoadStatus Table CREATE TABLE [dbo].[FileLoadStatus]( [ID] [int] IDENTITY(1,1) , [FileName] [varchar](100), LoadDateTime datetime default getdate()) --Base Script to Check if File is already loaded or not DECLARE @FileName VARCHAR(100) SET @FileName='CustomerFile.txt' IF EXISTS (SELECT 1 FROM [dbo].[FileLoadStatus] WHERE filename =@FileName) BEGIN SELECT 1 AS FileExistsFlg END ELSE BEGIN Select 0 AS FileExistsFlg END
How to Archive Already Loaded Files and Load New Files To SQL Server Table in SSIS Package
I think there is a need to look for some more information about SSIS and its crucial aspects.SSIS and its technicalities can always be fruitful to solve database related operations.
ReplyDeleteSSIS PostgreSql Write
Thanks, this is helpful.
ReplyDeleteTODAY I GOT MY DESIRED XMAS LOAN AMOUNT $520,000.00 FROM A RELIABLE AND TRUSTED LOAN COMPANY. IF YOU NEED A LOAN NOW EMAIL CONTACT drbenjaminfinance@gmail.com
ReplyDeleteHello, I'm here to testify of how i got my loan from BENJAMIN LOAN FINANCE(drbenjaminfinance@gmail.com) I don't know if you are in need of an urgent loan to pay bills, start business or build a house, they offer all kinds of loan. So feel free to contact Dr. Benjamin Owen he holds all of the information about how to obtain money quickly and painlessly without cost/stress via Email: drbenjaminfinance@gmail.com
Consider all your financial problems tackled and solved ASAP. Share this to help a soul right now THANKS.