• Something like this applied to your code:

    DECLARE @sql_files_path varchar(100) = '\\SomeServer\Somepath\'

    DECLARE @BulKInsert nvarchar(300)

    SET @BulkInsert = '

    BULK INSERT #fileContent FROM ''' + @sql_files_path + 'receipt_header.sql''

    WITH (FIELDTERMINATOR ='' | '',ROWTERMINATOR ='' '');'

    PRINT @BulKInsert

    EXEC sp_executesql @BulkInsert;

    Yes, this is a good place for a cursor. There's no way to import a set of files, they must be done one by one and a cursor is the way to go. Be sure to configure it correctly and don't leave the defaults.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2