• Hi Jonathan,

    Thanks for your reply.

    Unfortunately, I couldn't find a way to make the logic work in T-SQL.

    Basically I need to update the main table with rows from the 4 sub-tables, comsuming the rows from them as they are used. They way in which they are used is dependent on each other. For example, once I add a system from stock to an order there is no need to look for further System works orders or sensors but if I use a System works order I then also need to add a sensor.

    The only way I could see to do this was to use multiple cursors on a row by row basis and since RBAR is required VB seemed appropriate.

    If you can suggest a way I could acheive my objective in T-SQL I would be more than happy as it would save me a lot of work. 🙂