December 21, 2009 at 6:01 am
Hi here is my code....
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic 2008.
' The ScriptMain is the entry point class of the script.
Imports System
Imports System.Data
Imports System.Math
Imports System.IO
Imports Microsoft.SqlServer.Dts.Runtime
<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
Dim oWrite As System.IO.StreamWriter
Dim A As String
Dim Ctr As Integer = 0
Dim i As Integer = 1
Dim j As Integer = ""
Dim N1 As Integer = 75
Dim N2 As Integer = 150
Dim str As String = ""
Dim str1 As String = ""
Dim str2 As String = ""
Dim str3 As String = ""
Dim str4 As String = ""
Public Sub Main()
oWrite = IO.File.CreateText("E:\Script\LoveLace_output.txt")
oRead = IO.File.OpenText("E:\Script\LoveLace\Source.txt")
While oRead.Peek <> -1
A = oRead.ReadLine()
j = CInt(Round(A.Length / N2)) + 1
'MsgBox(A.Length)
For Me.i = 1 To j
If (A.Length > N1) Then
If i = 1 Or (i Mod 7) = 1 Then
str = A.Substring(0, N1)
Ctr += 1
oWrite.WriteLine("TOG N1 " & str)
'oWrite.WriteLine(str)
'MsgBox(str.Length)
'A = A.Substring(N1 + 1, A.Length - N1)
A = A.Substring(N1)
Else
If (A.Length > N2) Then
str1 = A.Substring(0, N2)
Ctr += 1
oWrite.WriteLine(str1)
'MsgBox(str1.Length)
A = A.Substring(N2)
Else
str2 = A.Substring(0, A.Length)
Ctr += 1
oWrite.WriteLine(str2)
If A.Length > N2 Then
A = A.Substring(N2)
End If
'MsgBox(str2.Length)
End If
End If
End If
Next
If A.Length <= N1 And A.Length > 0 Then
str4 = A.Substring(0, A.Length)
'oWrite.WriteLine(str4)
If Ctr = 0 Or Ctr Mod 7 = 0 Then
oWrite.WriteLine("TOG N1 " & str4)
Else
oWrite.WriteLine(str4)
End If
'MsgBox(str4.Length)
End If
Ctr = 0
End While
oWrite.Close()
Dts.TaskResult = ScriptResults.Success
End Sub
End Class
Thanks & Regards,
Shriram.
December 21, 2009 at 6:16 am
Since it is double posted, I'll say it again here for clarity.
What's the point?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply