• It seems that you want a script which could read through the text files and dump the data into tables into sql server.

    If , my understanding is correct , then you could try creating linked server with text files.

    It is a very fast and easy method to get all your text files data into tables.

    But make sure that the structure of your text file must match to your tables in database.

    use the below command

    EXEC sp_addlinkedserver testingtext_data, 'Jet 4.0',

    'Microsoft.Jet.OLEDB.4.0',

    'H:\patientdata\', --file path or i would say folder path where all your text files are placed

    NULL,

    'Text' --for textfile linkedserver

    GO

    once the linked server is created you coud run a command to read its text

    like

    select * from testingtext_data...tablename;

    For perfoming the same for all files , try create cursor.

    Regards,

    Sachin