本文介绍了在CSV中选择特定列并插入SQL表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好, 我有一个包含大量列和行的CSV文件(TAB分隔)。 例如: ABCDEFGHILMNO 1 2 3 4 5 6 7 8 9 0 1 2 3 我想只选择特定的列,比如CH L. 从CHL栏中获取结果后,我想要使用INSERT语句将数据放入SQL表。 我该怎么办? Best问候
Hi everyone, I have a CSV file (TAB delimited) with lot of columns and rows. For example: A B C D E F G H I L M N O 1 2 3 4 5 6 7 8 9 0 1 2 3 I wanto to select only specific columns, like C H L. After obtaining the results from the columns C H L , I wanto to put data into a SQL table using INSERT statment. How can i do it ? Best Regards
推荐答案写一个 CSV 解析器或从网上获取一个(例如参见代码项目文章 CSV分析程序(C#) [ ^ ]),抓取请求的数据然后插入他们进入数据库(你可能会发现只有 Google播放 [ ^ ]。 Write a CSV parser or get one from the web (see for instance this Code Project article CSV Parser (C#)[^]), grab the requested data and then insert them into the database (you may find man y tutorials available just Googling for[^]).
您可以将CSV导入数据集,如使用OleDb导入文本文件(选项卡,CSV,自定义) [ ^ ]。这样您就可以非常轻松地提取特定列。 You can import the CSV into a dataset as described in Using OleDb to Import Text Files (tab, CSV, custom)[^]. This will allow you to extract specific columns quite easily.
更多推荐
在CSV中选择特定列并插入SQL表
发布评论