SSIS or SQL Server way of sectioning a flat file
using ssis and some c# / vba


add a foreach loop to iterate over the files
create a variable to use for the key (increment on each iteration)
in the loop add a dataflow consisting of

a script transform (source) to read first 40 lines from the file and pivot
a derived column to add the key (from var)
a destination to the table

in the loop add a dataflow consisting of

a script transform (source) skipping the first 40 lines and reading the rest
a derived column to add the key (from var)
a destination to the table

[optional] delete or move the file with a file task


the code for pivoting would read the first 40 lines into an array then just set the output columns mapping to the array's index.

consideration may need to be given to insure the key remains unique on subsequent runs and may need initialising to the max(key) + 1 from exiting data, use an sql task for this.