How are you importing?
What version of SQL Server are you using?
To make this work properly you will need to import the data into a table with an IDENTITY columns to preserve sequence.
Then there are a few ways to process the data in the way you ask.
Far away is close at hand in the images of elsewhere.
Anon.