Checking a batch DataTable (IDs) in the database

0

I have a small desktop application (Windows Forms - .NET 2.0 - C #) in which I only use it to perform a check on a particular hourly path and, if this check finds any .txt file in this path, it is an import of this file was performed.

However this file has a column with a specific ID and what I do today, it is line by line to check if this ID exists in the database. If so, ignore it, if it does not matter.

What I would like to have a help with is if there is any way I can do this batch? Without a line-by-line "loop". Something that I sent to the bank this list of IDs and it realized an "IN" and I returned which were not found, and yes yes to realize the insertion (bulk insert).

    
asked by anonymous 31.03.2016 / 17:19

1 answer

0

The solution found was to create a TYPE with a TABLE structure and later a STORED PROCEDURE that checks IN if the data sent by .NET exists in the database. The return was sensational. I was able to reduce the time by ~ 40min. for ~ 3min., a total of 13 files and more than 100,000 records.

    
31.03.2016 / 22:32