• That stored procedure does exactly what you need to do.

    -- Gianluca Sartori