Reply to thread

my suggestion is to create a temporary table  (a table with name prefixed by #) with the layout of your data file, execute bulk insert against that and do your processing against the temp table.

 

for example. . .

 

c:\Data.txt contains:

 

0,"Value0",0

1,"Value1",0.000283687943262411

2,"Value2",0.000567375886524823

3,"Value3",0.000851063829787234

 

my code would look something like:

[php]

    cmd.CommandText = "create table #importTable (i int, label varchar(255), n float)";

    cmd.ExecuteNonQuery();

 

    cmd.CommandText = "BULK INSERT #importTable from d:\data.txt " +

                " WITH (FIELDTERMINATOR  = , , KEEPNULLS)"

    cmd.ExecuteNonQuery()

[/php]

 

then I would do what ever I needed to do with #importTable 

 

remember #importTable will be dropped when the connection closes because it is temporary


Back
Top