By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,064 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,064 IT Pros & Developers. It's quick & easy.

Need help with VB.NET and SSIS. I Have 0 Knowledge of VB.NET

P: 3
HI everyone.
I need to make a Task Script in SSIS that can read s CSV FILE and then modified it.
In the last column the person who write the information add some NEWLINES so some information is added in another row.
I need to read the file, found the rows with the problem and rewrite it with the lost information and delete the rows with problems



As you can see the text in the row 5502 should be in the last column of the row 5501 and then delete the row 5502
Dec 9 '16 #1

✓ answered by codegazer

I'm not here to write code for you, but I'm happy to point you in the right direction. (see below)

It gets more slightly more complicated if you need to append something to the previous line as per your example, but this should get you started. Have a go - people will help more if you will try.

Something on the lines of. . . .

Expand|Select|Wrap|Line Numbers
  1.  
  2. Open filename1 for input as #1
  3. open filename2 for output as #2
  4.    While not EOF(1)  
  5.       read line from file1
  6.       if line is ok
  7.          write line to file2
  8.       else
  9.          ignore
  10.       end if 
  11.    wend
  12. close #1
  13. close #2
  14.  
  15.  

Share this Question
Share on Google+
4 Replies


P: 27
I'm afraid you're taking slightly the wrong view.
You can't move data and then 'delete row 5502'. This is a CSV file and all you do is to read the file, check each line in turn, adjust the data if need be, then write the file back to disk. You won't delete a row, you just won't write an empty one.
Dec 11 '16 #2

P: 3
Thank for the answer :)
There is way to read the file make some IF or FOR that ignore the row when this have less than X characters and then copy all the rows to a new file ?
Dec 12 '16 #3

P: 27
I'm not here to write code for you, but I'm happy to point you in the right direction. (see below)

It gets more slightly more complicated if you need to append something to the previous line as per your example, but this should get you started. Have a go - people will help more if you will try.

Something on the lines of. . . .

Expand|Select|Wrap|Line Numbers
  1.  
  2. Open filename1 for input as #1
  3. open filename2 for output as #2
  4.    While not EOF(1)  
  5.       read line from file1
  6.       if line is ok
  7.          write line to file2
  8.       else
  9.          ignore
  10.       end if 
  11.    wend
  12. close #1
  13. close #2
  14.  
  15.  
Dec 13 '16 #4

P: 3
Thanks, you really help me a lot!!
I was doing something like that but with your help i can make it better.
Thanks again
Dec 13 '16 #5

Post your reply

Sign in to post your reply or Sign up for a free account.