I would like to insert a raw data file which is here in the form of .txt
, with tab separated data into a SQL Server table.
I would like to perform this operation with the help of a C# application, but stumble upon how to do this as the file has more than 1 million records in it.
I will much appreciate for the help and to get some pointers on this.
e.g. I have raw data file (tab separated) named myfile.txt
and I would like to create a table in my SQL Server database. This file have values which may have various form of datatypes, (e.g. It has datetime part, integer value, nvarchar string etc.) and we have to create the SQL Server table with exactly same columns and corresponding datatypes.
.txt
file would be as below
2015-07-28 18:41:07 9f4768273621d04da45e732932278497 SAM
2015-07-27 18:41:07 9f4768273621d04da45e732932278497 Ricky
2015-07-26 18:41:07 9f4768273621d04da45e732932278497 Roxy
Table structure so formed should appear like below:
Date Time UserID UserName
2015-07-28 18:41:07 9f4768273621d04da45e732932278497 SAM
2015-07-27 18:41:07 9f4768273621d04da45e732932278497 Ricky
2015-07-26 18:41:07 9f4768273621d04da45e732932278497 Roxy
Where:
Date
,Time
column ofDateTime
datatypeUserId
will be ofnvarchar(100)
Usename
will benvarchar(50)