简体   繁体   English

用于从平面文件填充SQL的SSIS脚本

[英]SSIS Script to populate SQL from Flat File

I have been asked to migrate a DTS package to SSIS and I am having a hard time wrapping my brain around how the task is done. 我被要求将DTS包迁移到SSIS,我很难围绕任务完成情况。 Currently, the DTS package grabs all the rows from the flat file, performs some logic on the data, and migrates them to the sql table using an active x transformation. 目前,DTS包从平面文件中获取所有行,对数据执行一些逻辑,并使用活动x转换将它们迁移到sql表。 I am very new to this, but I think once I get the source and destination configured and callable from the C# code I will be fine. 我对此非常陌生,但我认为一旦我从C#代码中配置和调用源和目标,我就可以了。 Can someone point me at a good tutorial on this or tell me the basic steps to set this up? 有人可以指点我这方面的好教程或告诉我设置它的基本步骤吗? Thanks 谢谢

The way SSIS works is that it is control flow centric and data is moved through memory buffers within the data flow. SSIS的工作方式是以控制流为中心,数据通过数据流中的内存缓冲区移动。 The high level steps that you need to take are as follows, I can't be more specific without further detail in your question: 您需要采取的高级步骤如下:如果您的问题没有进一步详细说明,我不能更具体:

In BIDS, create a new project, based on the SSIS template. 在BIDS中,基于SSIS模板创建一个新项目。

It will create an empty package called Package1 - rename this to something sensible by clicking on the name and typing a new one. 它将创建一个名为Package1的空包 - 通过单击名称并键入新名称将其重命名为合理的名称。 It will prompt you to change the name in the file system as well. 它还会提示您更改文件系统中的名称。 Accept this change. 接受此更改。

You should see the Control Flow design surface in front of you. 您应该在您面前看到控制流设计图面。 If you don't, double click on the package you have just renamed to open it. 如果不这样做,请双击刚重命名的包以将其打开。

From the Control Toolbox, drag over a Data Flow task onto the surface. 从“控件工具箱”中,将“数据流”任务拖到曲面上。

Double click the Data Flow atask to open the Data Flow design surface. 双击数据流atask以打开数据流设计图面。

Drag a Flat file source onto the design surface and double click it to open the properties and choose New to create a new flat file connection. 将Flat文件源拖到设计图面上,然后双击它以打开属性,并选择New以创建新的平面文件连接。 Give the connection manager a name and then browse to the location of the file in the file system. 为连接管理器命名,然后浏览到文件系统中文件的位置。

Set the other properties as appropriate for your file and then move to the columns tab. 根据您的文件设置其他属性,然后移至列选项卡。

On the columns tab, set the data types for the file as appropriate and then OK to exit the properties screen. 在“列”选项卡上,根据需要设置文件的数据类型,然后单击“确定”退出属性屏幕。

Drag transformations as appropriate to the design surface. 将变换拖拽到设计图面。 If it needs to be ac# script, then this would be a Script Transformation but SSIS has a rich set of transformations so custom code may not be required. 如果它需要是ac#script,那么这将是一个脚本转换,但SSIS有一组丰富的转换,因此可能不需要自定义代码。 Join each transformation with a data path by dragging the green tail of the path from the preceding transformation to the succeeding one. 通过将路径的绿色尾部从前一个转换拖动到后一个转换,将每个转换与数据路径连接起来。

Drag an OLEDB Destination to the surface and connect a green data flow path. 将OLEDB目标拖动到曲面并连接绿色数据流路径。 Double click it to edit the properties. 双击它以编辑属性。

Click New and then new again to create a connection manager and then enter your DB Server details. 单击“新建”,然后再次单击“新建”以创建连接管理器,然后输入数据库服 Click OK and then select the table in the database you want to insert the data into. 单击“确定”,然后在要插入数据的数据库中选择表。

Now click the map pings tab. 现在单击地图ping选项卡。 Columns will map automatically by name, but make any modifications required. 列将按名称自动映射,但需要进行任何修改。 Ok out of the properties, click the plan button to run the package in debug mode and start debugging and fix any issues 单击属性,单击计划按钮以在调试模式下运行程序包并开始调试并修复任何问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM