I have a text file with header, detail and footer rows . I want to import only detail rows to sql server table.
1st row has file name and last row has total records and in between all are data rows
For that I did the following.
1) In Flat file source I selected format as 'Ragged Right' and sending that out put to a script task .
2)In script task I renamed input column as Data which has value of NYC|Ny|Usa|Earth
3)In script task under output column I added output columns City,State,Country,univers
Now I want to connect this script task to Oledb destination and insert all the values in a table with 4 separate columns.
I am not from .Net background . Can some one help how to write a vb or c# script in script task
In place of Script task you can use script component as source for that. You can find the details from the below link.
Import the text file as one column by choosing another delimiter than |.
If possible, get rid of the header and the footer in a conditional split.
Use a script component as a transformation. If you didn't get rid of the header and the footer, now is the time. Use the .NET string.split function to split out the data using the | delimiter. Assign the resulting array to the output columns and write them to the OLE DB destination.
Another option would be to use a BULK INSERT with format file.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs