有没有办法有条件地将值传入此语句?
OUTER APPLY [dbo].[udf_GETVMSFleet](o.ClientNum, ou.[UnitNum]) AS orgLevels
我需要的是说ou.UnitNum =''然后ou。[TailerNum]
答案 0 :(得分:3)
函数调用允许参数表达式(与存储过程不同)
OUTER APPLY [dbo].[udf_GETVMSFleet](o.ClientNum,
CASE WHEN ou.[UnitNum] = '' THEN ou.[TailerNum] ELSE ou.[UnitNum] END
) AS orgLevels