ssis script component
What I have to do is taking form one folder multiple files and getting each files multiple sheets into one single sql table all have same metadata. and i am having these errors. [Script Component [1]] Error: System.IndexOutOfRangeException: Index was outside the bounds of the array. at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100 wrapper, Int32 outputs, Int32[] outputIDs, IDTSBuffer100[] buffers, IntPtr ppBufferWirePacket) [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Script Component" (1) returned error code 0x80131508. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. Can anyone suggest me what am i supposed to do? I have followed below link to create my package. http://biresort.net/blogs/pedrocgd/archive/2009/08/06/stepbystep-ssis-extract-data-from-multiple-excel-worksheets.aspx With one extra For each loop container to move into each files. Previously i was getting at least one file I mean to say it was going into one file through all sheets and when it comes to another file it was failing but now its not doing anything. I don't know what i changed and what should i do now? I tried to ask on the forum with same error but it could not allowed me so i have to create new here is my script component script Imports System.Xml '>> ADDEDD <Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _ <CLSCompliant(False)> _ Public Class ScriptMain Inherits UserComponent Private connMgr As IDTSConnectionManager100 Private cnnXLS As OleDb.OleDbConnection Private tablesInFile As DataTable Public Overrides Sub PreExecute() Dim strXLS As String = Me.Connections.ExcelConnectionManager.ConnectionString cnnXLS = New OleDb.OleDbConnection(strXLS) cnnXLS.Open() tablesInFile = cnnXLS.GetSchema("Tables") End Sub Public Overrides Sub CreateNewOutputRows() Dim tableInFile As DataRow Dim intTableCount As Integer = 0 intTableCount = tablesInFile.Rows.Count Dim excelTables As String() Dim currentTable As String Dim intTableIndex As Integer = 0 ReDim excelTables(intTableCount - 1) For Each tableInFile In tablesInFile.Rows Me.Output0Buffer.AddRow() Me.Output0Buffer.ColSheet = tableInFile.Item("TABLE_NAME").ToString 'Me.Output0Buffer.ColDate = CDate(Mid(tableInFile.Item("TABLE_NAME").ToString, 2, 2) & "-" & CStr(IIf(Len(Month(Now).ToString) = 2, Month(Now).ToString, ("0" & Month(Now).ToString))) & "-" & Year(Now).ToString) excelTables(intTableIndex) = currentTable intTableIndex += 1 Next End Sub Public Overrides Sub ReleaseConnections() cnnXLS.Close() End Sub End Class BM19.23
October 15th, 2011 12:17pm

excelTables is not being used. Unless you plan to use it elsewhere, you could remove it. You are already putting the information into the output buffer. If you need to use excelTables, the currentTable variable is never set before you assign it to excelTables(intTableIndex). If I remove excelTables and currentTable from the script, I can get it to put the tab names into the output buffer so that they are sent along the data flow path.
Free Windows Admin Tool Kit Click here and download it now
October 17th, 2011 12:14am

Actually I am not good at scripting so i just copyied this from the link i mentioned. And I am not getting what are you trying to say. I have already given sheets name in output buffer Me.Output0Buffer.ColSheet = tableInFile.Item("TABLE_NAME").ToString So can you tell me ehat sgikd i do chnages in script? BM19.23
October 22nd, 2011 10:27am

Here is the changed script. It only places the tab names into the output buffer. <Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()> _ <CLSCompliant(False)> _ Public Class ScriptMain Inherits UserComponent Private connMgr As IDTSConnectionManager100 Private cnnXLS As OleDb.OleDbConnection Private tablesInFile As DataTable Public Overrides Sub PreExecute() Dim strXLS As String connMgr = Me.Connections.ExcelConnectionManager strXLS = connMgr.ConnectionString cnnXLS = New OleDb.OleDbConnection(strXLS) cnnXLS.Open() tablesInFile = cnnXLS.GetSchema("Tables") End Sub Public Overrides Sub CreateNewOutputRows() Dim tableInFile As DataRow Dim intTableCount As Integer = 0 intTableCount = tablesInFile.Rows.Count Dim intTableIndex As Integer = 0 For Each tableInFile In tablesInFile.Rows Me.Output0Buffer.AddRow() Me.Output0Buffer.ColSheet = tableInFile.Item("TABLE_NAME").ToString 'Me.Output0Buffer.ColDate = CDate(Mid(tableInFile.Item("TABLE_NAME").ToString, 2, 2) & "-" & CStr(IIf(Len(Month(Now).ToString) = 2, Month(Now).ToString, ("0" & Month(Now).ToString))) & "-" & Year(Now).ToString) intTableIndex += 1 Next End Sub Public Overrides Sub ReleaseConnections() cnnXLS.Close() End Sub End Class
Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2011 10:38am

I changed my script as you mentioned now it has not thrown error for scripting row set but it is showing me following errors 1. [Excel Source [268]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37. 2. [Excel Source [268]] Error: Opening a rowset for "'09$'" failed. Check that the object exists in the database. (File which i am talking as a source is having sheet name as 09 but still it is giving this error) 3. [SSIS.Pipeline] Error: "component "Excel Source" (268)" failed validation and returned validation status "VS_ISBROKEN".BM19.23
October 22nd, 2011 11:47am

my package main intention is to take excel files from one forlder and load them into one sql table moreover each excel files have multiple worksheets with different name.BM19.23
Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2011 11:48am

no need to worry about actually i have done mannually i mean first i wanted to do everything automated but then it was taking more than usual so what i did i followed the link i mentioned previous for all individual files in that folder and mentioed all files first sheet name in variables So now they all are in one single table. thank you very much for your help. I wish i could have done what i wished but i will try that whenever i will get free time.BM19.23
October 22nd, 2011 5:02pm

OK Sorry I could not get you further details today.
Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2011 5:07pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics