EDIT_____
Tuve que cambiar el SP PARA que acepte el parametro out
CREATE or alter PROCEDURE [dbo].[JSP_GetNextAutonumber2](@Type VARCHAR(20), @Salida VARCHAR(50) OUT)
AS
WHILE 1 = 1 BEGIN
DECLARE @Nbr VARCHAR(50);
UPDATE Auto_number SET @Nbr = Last_Nbr += 1 WHERE Type = @Type
IF @Type = 'SalesOrder'BEGIN
IF NOT EXISTS(SELECT 1 FROM SO_Header WHERE Sales_Order = @Nbr) BEGIN
SET @Salida = @Nbr;
break;
END
END ELSE IF @Type = 'PurchaseOrder' BEGIN
IF NOT EXISTS(SELECT 1 FROM PO_Header WHERE PO = @Nbr) BEGIN
SET @Salida = @Nbr;
break;
END
END ELSE IF @Type = 'Packlist' BEGIN
IF NOT EXISTS(SELECT 1 FROM Packlist_Header WHERE Packlist = @Nbr) BEGIN
SET @Salida = @Nbr;
break;
END
END ELSE IF @Type = 'Invoice' BEGIN
IF NOT EXISTS(SELECT 1 FROM Invoice_Header WHERE Document = @Nbr) BEGIN
SET @Salida = @Nbr;
break;
END
END
END
Y sigue saliendo vacío.
Resultado
string(8000) "" Col1: -----------------