devxlogo

SQL and arrays of data

SQL and arrays of data

Question:
I need to enter up to 1,600 measured data points into a SQL database. Each point makes one record. Is there a way to enter all of these records into the database without making 1,600 hits on the database? Is there some sort of block data entry? Right now I pass in a series of strings containing the points and parse the string inside the stored procedure. However, this way is certainly not very elegant.

Answer:
1,600 hits on a SQL Server database is not really all that much. However, if you want to make your inserts as painless as possible, you should check if BCP will work for you. Create a text file in which each row represents the values to be inserted into your table. Using BCP you can load them all into the Server quickly and painlessly. For more information on BCP, look at “Books Online,” which walks you through the process.

devx-admin

Share the Post: