.CSV文件和SQL Server中的SSIS包 [英] .CSV file and SSIS package in SQL Server
问题描述
我必须创建一个SSIS包来自动将数据从.csv文件格式迁移到SQL Server.但是我的.csv文件在我实际需要使用的表中的数据之前包含许多信息(有关无线传感器的初始状态信息).由于整个过程必须自动化,所以我想知道是否有任何方法可以绕过/忽略无用的信息并直接获取.csv文件中的数据.这样我就不需要每次都手动删除信息并创建一个新的.csv文件,然后为它创建一个新的SSIS包.
I have to create an SSIS package to automate the migration of data from a .csv file format to the SQL Server. But my .csv file contains a lot of information ( initial status information about wireless sensors ) before the data in the tables that I actually need to work with. Since the entire process has to be automated, I am wondering if there is any way I could bypass/ignore the useless information and directly get to the data in the .csv file. So that I don''t need to manually take off the information and create a new .csv file each time and then create a new SSIS package for it.
推荐答案
设置一个存储所有数据的存储过程,然后仅将所需的记录保存到最终表中.
更好的方法是使用.NET界面自动执行修剪.
Set up a stored procedure that takes in all data then only saves to the final table the records you want.
A better way would be to use a .NET interface to automate the trim.
您可以使用 OPENROWSET [ ^ ],以从文件中读取数据.如果知道了不感兴趣的行数,则可以定义在开始时跳过了多少行.可以使用 bcp [ ^ ]更合适.
Hi,
You could use OPENROWSET[^] in the SSIS package to read the data from the file. If the amount of non-interesting rows is known you can define how many rows are skipped in the beginning. The same can be done using bcp[^] if that''s more suitable.
这篇关于.CSV文件和SQL Server中的SSIS包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!