Import the record numbers from the CSV file to a database table. You can do that using Import/Export wizard (right click on the database name in object explorer in SQL Server Management Studio, then Tasks -> Import Data), or you could even construct insert statements in Excel.
Once you have the record numbers in a table, moving is easy enough. You can have two statements, one to insert and the other to delete:
INSERT INTO MainFileA
(col1, col2, ... colN)
m.col1, m.col2, ... m.colN
INNER JOIN RecordIDTable r on r.RecordId = m.RecordId;Then once the insert is successful, delete from the MainFile table, using the same join.
You can also use OUTPUT clause to do the insertion and deletion in a single statement, if that is a consideration (i.e., it is a production table and you don't want to have same records in MainFile table and MainFileA even for a short period of time)