我在清理数据的 SSIS 脚本组件中使用 VB.Net 语言。(视觉工作室 2010)
这是代码:
Public Sub Main()
Dim pk As New Package
Dim file As New System.IO.StreamReader(Dts.Variables("User::str_SourcePath").Value.ToString())
Dim data As String
data = file.ReadToEnd()
data = data.Replace("'", "")
data = data.Replace(Chr(0), "")
data = data.Replace(Chr(1), "")
file.Close()
Dim writer As New System.IO.StreamWriter(Dts.Variables("User::str_SourcePath").Value.ToString(), False)
writer.Write(data)
writer.Flush()
writer.Close()
Dts.TaskResult = ScriptResults.Success
End Sub
即使有非常大的文件,当我在本地运行此脚本任务时,它也会成功运行,但部署的包仅在处理大文件(即超过 100 MB)时在服务器上失败。(SQL Server 2012)