SQL: add a function to build SQL ADD string