Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Script Component leading blank row in flat file

Author  Topic 

tish95559
Starting Member

2 Posts

Posted - 2008-01-07 : 17:41:51
I have created a Script Component in my Data Flow that basically reads records from an SQL Table and outputs 3 rows for each input row. My problem is that the Script is outputing a blank row at the beginning of the file. I have requested no headers for the delimited file. I know it is the script because my data viewer from the table doesn't show this additional line where the data viewer from my script and the file has the additional blank line.
Any help would be greatly appreciated

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-07 : 22:45:05
What are you trying to do inside the script component?
Go to Top of Page

tish95559
Starting Member

2 Posts

Posted - 2008-01-08 : 10:48:39
quote:
Originally posted by visakh16

What are you trying to do inside the script component?


it is a very simple script which is why i am confused about why i am getting the extra blank line. I am using a simple transformation script. The code is -
Public Class ScriptMain
Inherits UserComponent
Public bFirst As Boolean = True
Public oData As String = " "
Public oHeader As String = " "
Public sEndofRow As Boolean = False
Public bDebug As Boolean = False
Public sMsg As String = " "


Public Overrides Sub salesByClassinput_ProcessInputRow(ByVal Row As salesByClassinputBuffer)


'Me.ComponentMetaData.FireInformation(1, "icount = ", CStr(icount), "", 0, True)
If bFirst = True Then
oData = "Actual"
Me.ComponentMetaData.FireInformation(1, "oData = ", oData, "", 0, True)
CreateNewOutputRows()
oData = CStr(ReadOnlyVariables("iYTDPeriod").Value)
Me.ComponentMetaData.FireInformation(1, "oData = ", oData, "", 0, True)
CreateNewOutputRows()
oData = CStr(ReadOnlyVariables("iYTDPeriod").Value)
Me.ComponentMetaData.FireInformation(1, "oData = ", oData, "", 0, True)
CreateNewOutputRows()
bFirst = False
End If

oHeader = Row.opconum & "," & Chr(34) & Row.classdesc & Chr(34) & ","
oData = oHeader & Chr(34) & "sales" & Chr(34) & "," & CStr(Row.sales)
sMsg = oData
Me.ComponentMetaData.FireInformation(1, "oData = ", oData, "", 0, True)
CreateNewOutputRows()

oData = oHeader & Chr(34) & "sales_margin" & Chr(34) & "," & CStr(Row.salesmargin)
'debugging code '
sMsg = oData
Me.ComponentMetaData.FireInformation(1, "oData = ", oData, "", 0, True)
CreateNewOutputRows()

oData = oHeader & Chr(34) & "case_sales" & Chr(34) & "," & CStr(Row.casesales)
sMsg = oData
Me.ComponentMetaData.FireInformation(1, "oData = ", oData, "", 0, True)
CreateNewOutputRows()



'
End Sub

Public Overrides Sub CreateNewOutputRows()



salesByClassoutputBuffer.AddRow()
salesByClassoutputBuffer.salesByClassdata = oData





End Sub

End Class
Go to Top of Page
   

- Advertisement -