If I were to do this project, I would prefer to write a C# application where the user enters the SQL Server username, password and server address (or just the server address if using Windows authentication) from the user, and runs an SQL query to get the list of fields (ID_Number and extra_code_1) and iterates through the list, updating each file and displaying this to the screen. I would suggest doing it this way, because C# has superior file handling methods to SQL Server. If this were acceptable, I would provide both the source code and executable file.
If you would prefer an SQL only solution, and are using T-SQL (Microsoft SQL Server), I would be fully capable of iterating through the list of rows in aview_person and using the SQL file access stored procedures. If you are using MySQL, it would be more difficult, however I am sure I would still be able to produce the required script.