Daily Feed a SQL server table from a CSV file in sFTP - sql-server

I have a CSV file that can be acessed only via sFTP.
The CSV file is daily updated (same structure but different values).
My aim is to daily copy the values of the CSV and paste it into a SQL Server table. Of course the process needs to be automated.
My CSV also contains too many row. The first column of the csv is 'ID'. And I have a fixed list of 'ID'. So I need to do some filtering before to paste into SQL Server
What would be the best option to reach the aim? Using an external ETL, Batch, PowerShell, SQL Script ?

Integration services (SSIS) is a good choice, because you can use a combinition of tasks (FTP connection, flat file source, t-SQL, ....), and you can integrate an SSIS package in SQL Server job to be executed daily.

Related

Update SQL Server (2014) table from an Excel email attachment

We track IPs that attack our site. First attack, we temp block them. Tf they ever attack again then we permanently blacklist them. Information for each attack by each IP is stored in perpetuum. Twice daily, reports with an Excel spreadsheet with all pertinent information is emailed to various people, and then the information is manually added to a massive spreadsheet. We've recently spun up a new box with SQL server and I've added all of the existing information to a table in the new database.
As I'm new to this, I would like to know if there is a way to send the daily spreadsheets to this new sql server and have it parse out the excel attachment and update our master tracking table. The spreadsheet will always have the same structure (15 columns and header and footer rows) with varying row quantities, and of course it matches the existing table structure.
I've been googling it and am only able to find queries (ba dum tish) on how to make SQL export to excel and send an email with Database Mail. Can't find anything on sending en email TO sql server and having it process an attachment.
You can make use of the SQL Server Integration Services(SSIS). You can write an SSIS package that import the data from the given Excel spreadsheet to a table and
then from that table you can write insert or update statements to your production table. You can use "Data Flow task" to Import the Data from the excel file and then write an " Execute SQL Task" which will update the values to Production table. Remember that you will have to keep the Excel file in the same folder all time (or else you can use dynamic statements to get the file name dynamically using Variables). Once you have completed the package you can schedule the package as an SQL Server Job which will run periodically and hence the data will be automatically updated.
Please refer this video for a basic idea about SSIS :
Import Data From Excel to SQL Server Using SSIS
Twice daily, reports with an Excel spreadsheet with all pertinent information is emailed to various people,
Try saving the File to a location and then use SSMS Export,Import Wizard ..This package can be saved and set to Run Daily
Here is a step by step tutorial covering the same..
https://www.mssqltips.com/sqlservertutorial/203/simple-way-to-import-data-into-sql-server/

Is there any way to integrate Box.com files with SQL tables via SSIS?

I need to automate the process of uploading SQL table data to folders in box.com. This is to avoid the manual process of converting sql tables to Excel or cvs file and uploading them to box.com. Any assistance is appreciated.
Thanks
Sam
Use OLEDB source as a source to connect to SQL server database and select the table you want to load. Connect it to flat file destination type as a destination and use box sync folder on your computer as destination connection and create an agent job to automate it.

how to load both csv and excel file in sql server using single connection manager in SSIS?

I want to load two types of file (CSV and Excel) which are placed in one folder in a signal sql server table. The no of column and column names are same in both files. How can we achieve this through SSIS using single Connection Manager?
Without doing something very over engineered in a script source task, this is not possible. Just have two connection managers, two data sources in the Data Flow and merge the two datasets with a Union All transformation.

Speeding Up ETL DB2 to SQL Server?

I came across this blog post when looking for a quicker way of importing data from a DB2 database to SQL Server 2008.
http://blog.stevienova.com/2009/05/20/etl-method-fastest-way-to-get-data-from-db2-to-microsoft-sql-server/
I'm trying to figure out how to achieve the following:
3) Create a BULK Insert task, and load up the file that the execute process task created. (note you have to create a .FMT file for fixed with import. I create a .NET app to load the FDF file (the transfer description) which will auto create a .FMT file for me, and a SQL Create statement as well – saving time and tedious work)
I've got the data in a TXT file and a separate FDF with the details of the table structure. How do I combine them to create a suitable .FMT file?
I couldn't figure out how to create the suitable .FMT files.
Instead I ended up creating replica tables from the source DB2 system in SQL Server and ensured that that column order was the same as what was coming out from the IBM File Transfer Utility.
Using an Excel sheet to control what File Transfers/Tables should be loaded, allowing me to enable/disable as I please, along with a For Each Loop in SSIS I've got a suitable solution to load multiple tables quickly from our DB2 system.

Loading many flatfiles into SQL Server 2005

I have a very annoying task. I have to load >100 CSV-files from a folder to SQL Server database. The files have column names in first row. Data type can be varchar for all columns. The table names in database can just be filename of the CSVs. What I am currently doing is that I use Import/Export Wizard from SSMS, I choose flatfile from dropdown box, choose the file, next->next->next and finish! Any ideas how can I automate such a task in Integration services or with any other practical method?
Note: Files are on my local PC, DB-server is somewhere else, so I cannot use BULK INSERT.
You can use SSIS - Foeach loop container to extract file names - by arranging to particular format.Use a variable to dynamically fill the variable with file name.Then in dataflowtask , use flat file source for source - oledb destination.
Please post some sample file names.so that i can learn and guide you properly.
Thanks
Achudharam

Resources