Apologies for digging this one up from the dead but just wondering why there wasn't any discussion on this previously... although I'm not sure if it is the most efficient way of doing things (ie using a cursor - seems a bit RBAR) it works perfectly and has just helped me hugely, so big thanks to Jano 🙂