6.5 update 6
An error pops up when trying to perform the end of day activity.
<Message>query did not return a unique result: 2</Message>
<ExceptionInfo>
<Type>NHibernate.NonUniqueResultException</Type>
<Message>query did not return a unique result: 2</Message>
<Source>NHibernate</Source>
<TargetSite>System.Object UniqueElement(System.Collections.IList)</TargetSite>
<StackTrace> at NHibernate.Impl.AbstractQueryImpl.UniqueElement(IList list)
at NHibernate.Impl.CriteriaImpl.UniqueResult[T]()
at NHibernate.Criterion.QueryOver`1.SingleOrDefault()
at NHibernate.Criterion.QueryOver`1.NHibernate.IQueryOver<TRoot>.SingleOrDefault()
at .[](IQueryOver`1 )</StackTrace>
Follow the below steps
exec sp_executesql N'SELECT this_.LaborSessionKey as LaborSes1_182_0_, this_.StoreKey as StoreKey182_0_, this_.UserKey as UserKey182_0_,
this_.JobCodeKey as JobCodeKey182_0_, this_.BusinessDate as Business5_182_0_, this_.StartDate as StartDate182_0_,
this_.EndDate as EndDate182_0_, this_.BreakCount as BreakCount182_0_, this_.TotalBreakTime as TotalBre9_182_0_,
this_.TotalTime as TotalTime182_0_, this_.Status as Status182_0_, this_.LastBreakTime as LastBre12_182_0_, this_.CreatedBy as CreatedBy182_0_, this_.Created as Created182_0_,
this_.ModifiedBy as ModifiedBy182_0_, this_.Modified as Modified182_0_ FROM LbrLaborSession this_ WHERE ((this_.StoreKey = @p0 and this_.UserKey = @p1) and not (this_.Status = @p2))',
N'@p0 bigint,@p1 bigint,@p2 int',@p0=10000000000002,@p1=20000000000004,@p2=3
select * from LbrLaborSession where storekey=10000000000002 and UserKey=20000000000004 and status <> 3
select * into LbrLaborSessionTemp from LbrLaborSession where storekey=10000000000002 and UserKey=20000000000004 and status <> 3
begin tran
Delete from LbrLaborSession where storekey=10000000000002 and UserKey=20000000000004 and status <> 3 and LaborSessionKey=20000000000718
rollback tran
Before executing delete query, take backup of records into temp table.