Sql string with trailing operator replacement now generic