How to insert many rows of data from arrays/lists to SQL Server (DataSet, DataTable)

Posted by Kamil on Stack Overflow See other posts from Stack Overflow or by Kamil
Published on 2012-10-04T15:32:13Z Indexed on 2012/10/04 15:37 UTC
Read the original article Hit count: 188

Filed under:
|
|
|

I need little help with transferring data from variables, arrays, lists to my SQL Server.

Im not bad in SQL, but im not familiar with DataSet, DataTable objects.

My data is now stored in list of strings (List). Every string in that list looks similar to this:

QWERTY,19920604,0.91,0.35,0.34,0.35,343840

There are about 900000 rows like this.

Target datatypes in SQL Server:

BIGINT (primary key, im not inserting it, its identity(1,1))
VARCHAR(10), 
DATE, 
DECIMAL(10,2), 
DECIMAL(10,2), 
DECIMAL(10,2), 
DECIMAL(10,2), 
INT
  1. How to convert that data to SQL Server data types?

  2. How to insert that data into SQL Server? Also i need some progress bar updates between inserts.

I could do this using old-fashion SQL command, but i have learn more modern way :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql-server