If you want to add additional data into a work file in InterFormNG2 via SQL, then you should consider to define an Xent file to define SQL lookups for that.
The Xent files should be uploaded to the transforms library.
If you want to add additional data into XML files, then you should refer to this section.
The Xent/SQL option for spooled files is covered here.