Hi Luis Cazares,
Could I just pick your brains please. Option 2 seems to be working great but I would like to change the table reference form wce_bookings to wce_quotes. I have tried changing the table name but then I get an error. 'Msg 1014, Level 15, State 1, Line 3 TOP clause contains an invalid value.'
The SQL is a little more complex than I am use to so I am guessing that this is also controlled in the function but I can't see how. Could you explain how to alter this please so I can better understand how this is referenced.
Many thanks.