We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
use WSS_Content declare @startDate datetime declare @endDate datetime set @startDate = '12/19/2009' set @endDate = '12/19/2009' set @endDate = @endDate + 1 DECLARE @TempTable TABLE(PONUM nvarchar(150), tp_WorkflowInstanceID uniqueidentifier, tp_Created datetime, tp_Modified datetime, Approval_Status nvarchar(150), Duration int ) insert into @TempTable (PONUM, tp_WorkflowInstanceID, tp_Created, tp_Modified, Approval_Status, Duration) select nvarchar17, tp_WorkflowInstanceID, tp_Created, tp_Modified, nvarchar12, (DATEDIFF(dd, tp_Created, tp_Modified) + 1) -(DATEDIFF(wk, tp_Created, tp_Modified) * 2) -(CASE WHEN DATENAME(dw, tp_Created) = 'Sunday' THEN 1 ELSE 0 END) -(CASE WHEN DATENAME(dw, tp_Modified) = 'Saturday' THEN 1 ELSE 0 END) as [Duration] --into #tmp from [Wss_Content].[dbo].[AllUserData] where tp_WorkflowInstanceID is not null order by nvarchar17, nvarchar14 select distinct t1.nvarchar17 as [PO Number], t1.nvarchar16 as [Amount], t2.Duration from [Wss_Content].[dbo].[AllUserData] as t1 inner join (Select PONUM, SUM(Duration) as Duration from @TempTable group by PONUM) as t2 on t1.nvarchar17 = t2.PONUM where t1.tp_Created between @startDate and @endDate and nvarchar10 = 'Test Inventory PO Workflow'
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.