HASHBYTE ロジックを処理するコードの次のセクションでエラーが発生します。
<ScriptComponentTransformation Name ="SCR HashByte Data Thread 1">
<ScriptComponentProject>
<ScriptComponentProject Name="SCRHashByteDataThread1">
<AssemblyReferences>
<AssemblyReference AssemblyPath="Microsoft.SqlServer.DTSPipelineWrap" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.DTSRuntimeWrap" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.PipelineHost" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.TxScript" />
<AssemblyReference AssemblyPath="System.dll" />
<AssemblyReference AssemblyPath="System.AddIn.dll" />
<AssemblyReference AssemblyPath="System.Data.dll" />
<AssemblyReference AssemblyPath="System.Xml.dll" />
</AssemblyReferences>
<InputBuffer Name="Input0">
<Columns>
<Column Name="RowNumber" DataType ="Int64" UsageType ="ReadWrite"></Column>
</Columns>
</InputBuffer>
<OutputBuffers>
<OutputBuffer Name="Output0">
<Columns>
<Column Name="MD5" DataType ="AnsiStringFixedLength"></Column>
</Columns>
</OutputBuffer>
</OutputBuffers>
<Files>
<File Path ="AssemblyInfo.cs">
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("SC_AddRowNumber")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SC_AddRowNumber")]
[assembly: AssemblyCopyright("Copyright @ Homeserve 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
</File>
<File Path ="main.cs">
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Text;
using System.IO;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
private System.Security.Cryptography.MD5 _md5 =new System.Security.Cryptography.MD5CryptoServiceProvider();
public override void PreExecute()
{
base.PreExecute();
}
public override void PostExecute()
{
base.PostExecute();
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
var errorMsg = string.Empty;
byte[] hashBytes;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
try
{
string hashSource =
(Row.ColA_IsNull ? "" : Row.ColA.ToString())
+ (Row.ColB_IsNull ? "" : Row.ColB.ToString())
+ (Row.ColC_IsNull ? "" : Row.ColC.ToString()));
hashBytes = _md5.ComputeHash(
System.Text.UnicodeEncoding.Unicode.GetBytes(hashSource));
for (int i = 0; i <![CDATA[<]]> hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("X2"));
}
//Row.MD5 = "0x" + sb.ToString();
}
catch (Exception e)
{
errorMsg = e.Message;
}
finally
{
Row.MD5 = "0x" + sb.ToString();
}
if (errorMsg != null <![CDATA[&&]]> errorMsg != string.Empty)
Row.MD5 = "Error";
}
}
</File>
</Files>
</ScriptComponentProject>
</ScriptComponentProject>
</ScriptComponentTransformation>-->