DatabaseScript: Add variables from the SQL query to the SQL_BY_DOC

function