ALTER PROCEDURE [dbo].[usp_SalesOrderForUnit_Select] @UnitID BigInt AS BEGIN SELECT DISTINCT so.Number as SalesOrder ,sog.Number as SalesOrderGroup ,so.NumberPurchaseOrder as PurchaseOrder FROM -- UnitSetup.UnitDetail AS ud --INNER JOIN ProductionControl.ContainerContent cc -- ON ud.UnitHeaderId = cc.UnitHeaderId -- AND cc.DateEffectiveOut = '99991231 23:59:59.999' --INNER JOIN UnitSetup.SalesOrderGroupVersion AS sogv -- ON sogv.SalesOrderGroupVersionId = cc.SalesOrderGroupVersionId --INNER JOIN UnitSetup.SalesOrderGroup AS sog -- ON sog.SalesOrderGroupId = sogv.SalesOrderGroupId --INNER JOIN UnitSetup.SalesOrder AS so -- ON so.SalesOrderId = sog.SalesOrderId UnitSetup.UnitIdentity AS ui INNER JOIN UnitSetup.SalesOrder AS so ON ui.SalesOrderId=so.SalesOrderId AND ui.DateEffectiveOut=CAST('99991231 23:59:59.999' AS DATETIME2(3)) INNER JOIN UnitSetup.SalesOrderGroupVersion AS sogv ON sogv.SalesOrderGroupVersionId=ui.SalesOrderGroupVersionId INNER JOIN UnitSetup.SalesOrderGroup AS sog ON sog.SalesOrderGroupId=sogv.SalesOrderGroupId AND sog.SalesOrderId=so.SalesOrderId WHERE ui.UnitHeaderId = @UnitID END
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)