I have the following query:

select sq.*, p.numero, p.nombre
from paf p right outer join dbo.GetListOfSq uaresForShippin gLot(@lot) sq on sq.number = p.numero and sq.version = p.numero

The @lot parameter is declared at the top (declare @lot int; set @lot = 1;). GetListOfSquare sForShippingLot is a CLR TVF coded in C#. The TVF queries a XML field in the database and returns nodes as rows, and this is completed with...