#title SSIS-Split here 다음과 같이 ssis 패키지를 꾸며놓고... attachment:SSIS-Split/01.png ==== OLE DB 원본 ==== {{{ select 1 p_key, '1,100|2,200|3,300' money_log union all select 1 p_key, '6,600|5,500|4,400' money_log union all select 1 p_key, '7,700|8,800|9,900|10,1000' money_log }}} ==== 스크립트 구성요소 ==== 스크립트 구성요소에서 "out2"라는 출력을 추가하고... {{{ /* Microsoft SQL Server Integration Services Script Component * Write scripts using Microsoft Visual C# 2008. * ScriptMain is the entry point class of the script.*/ using System; using System.Data; using Microsoft.SqlServer.Dts.Pipeline.Wrapper; using Microsoft.SqlServer.Dts.Runtime.Wrapper; [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute] public class ScriptMain : UserComponent { public override void PreExecute() { base.PreExecute(); /* Add your code here for preprocessing or remove if not needed */ } public override void PostExecute() { base.PostExecute(); /* Add your code here for postprocessing or remove if not needed You can set read/write variables here, for example: Variables.MyIntVar = 100 */ } public override void 입력0_ProcessInputRow(입력0Buffer Row) { /* Add your code here */ string[] result = Row.moneylog.Split(new char[] { '|', ',' }); for (int i = 0; i < result.Length; i++) { out2Buffer.AddRow(); out2Buffer.pkey = Row.pkey; out2Buffer.moneycode = int.Parse(result[i].ToString()); out2Buffer.gamemoney = int.Parse(result[i + 1].ToString()); i++; } } public override void CreateNewOutputRows() { /* Add rows by calling the AddRow method on the member variable named "Buffer". For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput". */ } } }}} ==== out2 결과 ==== attachment:SSIS-Split/02.png ---- C#에서 변수처리는 이렇게.. {{{ Dts.Variables["변수"].Value = "변수값이냐?"; }}} -- 이재학 2011-12-22 10:01:44