我在SQL 2008中创建了以下函数
CREATE FUNCTION dbo.udfSetSupplyStatus(@strOrderID nvarchar(16), @intLineNo int, @intOrderQty int, @strPartID nvarchar(16), @strWarehouseID nvarchar(16), @dtAsOfDate datetime, @strCalcMode nvarchar(16))
RETURNS nvarchar(32)
AS
BEGIN
DECLARE @strReturnValue nvarchar(32), @intQtyOnHand int, @intQtyOnOrder int, @intQtyPlanned int, @dtWantDate datetime
IF (@strCalcMode = 'S')
BEGIN
SELECT
@intQtyOnHand = (pw.available_qty + pw.committed_co + pw.committed_req + pw.committed_ibt + pw.locked_qty),
@intQtyOnOrder = (pw.expected_po + pw.expected_wo)
FROM VE_PART_WAREHOUSE as pw
INNER JOIN VE_PART as p on pw.part_id = p.id
WHERE pw.part_id = @strPartID
and pw.warehouse_id = @strWarehouseID
END
BEGIN
select
@dtWantDate = WANT_DATE,
@intQtyPlanned = ORDER_QTY
from VE_PLANNED_ORDER
where PART_ID = @strPartID
AND WAREHOUSE_ID = @strWarehouseID
END
IF(@intQtyOnHand >= @intOrderQty)
SET @strReturnValue = 'InStock'
ELSE IF(@intQtyOnHand + @intQtyPlanned) >= @intOrderQty
SET @strReturnValue = 'Expected'
ELSE
SET @strReturnValue = 'NoSupply'
RETURN @strReturnValue
END
我可以在我正在使用的数据库中看到可编程性下的标量值函数中的函数,但是当我尝试调用函数时,Intellisense没有检测到我的函数。