Middle of SQL inserting intermediate commit
Debugged version that now does not create multiple insert statements