Patching a sql variable which wasn't formatted