Create a Scalar-valued function to get the total code example
Example 1: functions with parameters SQL
SET @OrderID = dbo.GetOrderID (default, default, default);
Example 2: functions with parameters SQL
EXEC @OrderID = dbo.GetOrderID
@OrderType = @OrderType,
@ServiceSpeed = @Qty,
@Qty = @ServiceSpeed;