Scalar function syntax error

  • saintor1 - Friday, October 13, 2017 6:10 AM

    Ok *success*, I think that I figured out the use of table UDF...

    SELECT   I.StockCode, I.Description, I.AlternateKey1 AS Family,
             I.LeadTime, I.Ebq, W.Warehouse, U.RET AS QtyOnHandNoExcl,
             W.QtyInTransit, W.QtyOnOrder, W.QtyAllocatedWip,
             W.QtyAllocated AS QtyAllocatedSales, W.UnitCost, W.DateLastSale,
             W.DateLastPurchase, W.UserField1 AS MINMAXCTRL, W.MinimumQty,
             W.MaximumQty, W.ReOrderQty AS ReOrderPt, W.YtdQtySold,
             W.PrevYearQtySold, I.Supplier, I.Version,
             I.StockOnHold, I.CountryOfOrigin, I.PartCategory
    FROM    SysproSStar.dbo.InvMaster I INNER JOIN
             SysproSStar.dbo.InvWarehouse W ON I.StockCode = W.StockCode OUTER 
             APPLY dbo.QtyOnHandNoExcl(W.StockCode, W.Warehouse, 'K') U;

    That looks to be the ticket.  Thanks for the feedback.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply