Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Write and delete CSV files in SQL database

$
0
0

Hi !

I have a question about creating a job in SQL 2012 and I would like some help.

So I have a local folder on a PC which contains CSV files that are generated by another system via VBS script with unique names as follows ("id_yyyymmdd_hhmmss"):

"id_20190913_090000",

"id_20190913_094512",

"id_20190913_103205", ...

I need to create a scheduled SQL Server Agent job (e.g. every minute) that runs a package with a dataflow as follows: if there are CSV files in this local folder when the event occurs that is written to SQL database of each files in the correct order (oldest to newest file) and only after writing the data contained in the CSV file the CSV file be deleted from the local PC folder.

The intention is to create a kind of buffer (local folder) between the system that generates the CSV files via script and the SQL database so that, in case of communication loss or slowness, it does not affect writing to the SQL database. Currently the system writes directly to the SQL database via script (without generating CSV files), however it is generating slowness since each write has to open the connection to the database and then close, stopping the execution of the script.


What I would like to ask help is how to save multiple CSV files in the SQL and after the confirmation of writing delete the recorded file.

I appreciate any help!

Cheers,
Berg


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>