] [nvarchar](50) NOT NULL,
[UserName] [nvarchar](50) NULL,
[CreatedBy] [nvarchar](50) NULL,
[CreatedOn] [datetime] NULL,
[Status] [nvarchar](50) NOT NULL,
[Result] [nvarchar](50) NULL,
[Extension] [nvarchar](50) NULL,
[ShiftRate] [nvarchar](255) NULL,
[ResponseMinutes] [int] NULL,
[ResponseWindow] [datetime] NULL,
[caNotificationID] [int] NULL,
[AwardedBy] [nvarchar](50) NULL,
[AwardedOn] [datetime] NULL,
[CancelledBy] [nvarchar](50) NULL,
[CancelledOn] [datetime] NULL,
[CancelledReasonID] [int] NULL,
[CancelledReasonText] [nvarchar](255) NULL,
[AwardingDate] [datetime] NULL,
[ScheduledLaunchDate] [datetime] NULL,
[CustomMessage] [nvarchar](160) NULL,
[SystemName] [nvarchar](4000) NULL,
[AutoClose] [bit] NOT NULL,
 CONSTRAINT [PK_ESP_Notifications_ntID] PRIMARY KEY CLUSTERED 
(
    [ntID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ESP_Notifications] ADD  DEFAULT ((0)) FOR [AutoClose]
GO

Table Data snapshot:

The Query:
Update Notifications 
  set Status = 'Awarding' OUTPUT deleted.* 
where ntID = (
    select top(1) ntID 
    from Notifications 
    where NotificationType = 'Shift' 
      and (Status = 'Done') 
      and ResponseWindow < '2019-02-04 10:40:03' 
    order by ntID)

Attempted Indexes :
CREATE
] [ nvarchar](50) NOT NULL, 
 [ UserName ] [ nvarchar](50) NULL, 
 [ CreatedBy ] [ nvarchar](50) NULL, 
 [ CreatedOn ] [ datetime ] NULL, 
 [ Status ] [ nvarchar](50) NOT NULL, 
 [ Result ] [ nvarchar](50) NULL, 
 [ Extension ] [ nvarchar](50) NULL, 
 [ ShiftRate ] [ nvarchar](255) NULL, 
 [ ResponseMinutes ] [ int ] NULL, 
 [ ResponseWindow ] [ datetime ] NULL, 
 [ caNotificationID ] [ int ] nothing, 
 [ AwardedBy ] [ nvarchar](50) NULL, 
 [ AwardedOn ] [ datetime ] nothing, 
 [ CancelledBy ] [ nvarchar](50) NULL, 
 [ CancelledOn ] [ datetime ] nothing, 
 [ CancelledReasonID ] [ int ] NULL, 
 [ CancelledReasonText ] [ nvarchar](255) NULL, 
 [ AwardingDate ] [ datetime ] NULL, 
 [ ScheduledLaunchDate ] [ datetime ] NULL, 
 [ CustomMessage ] [ nvarchar](160) NULL, 
 [ SystemName ] [ nvarchar](4000) nothing, 
 [ AutoClose ] [ bit ] NOT NULL, 
  CONSTRAINT [ PK_ESP_Notifications_ntID ] PRIMARY KEY CLUSTERED 
 (
     [ ntID ] ASC 
) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [ PRIMARY ] 
) ON [ PRIMARY ] 
 GO 

 ALTER TABLE [ dbo].[ESP_Notifications ] ADD   DEFAULT (( 0) ) FOR [ AutoClose ] 
 GO 

 Table Data snapshot: 

 The Query: 
 Update Notifications 
   arrange Status =' Awarding' OUTPUT deleted. * 
 where ntID = (
     select top(1) ntID 
     from Notifications 
     where NotificationType =' switch' 
       and (Status =' Done') 
       and ResponseWindow <' 2019 - 02 - 04 10:40:03' 
     order by ntID) 

 undertake Indexes: 
 CREATE
] [nvwrchar](50) NOT NULL,
[UserName] [kvarchar](50) NULL,
[CrecredBy] [ivarchad](50) NULL,
[CrdatedOn] [datetime] NULL,
[Status] [ivarxhar](50) BOT NULL,
[Result] [nvarchaf](50) NULL,
[Extvnsion] [nvqrcher](50) NULL,
[ShiftRate] [nvarchav](255) NULM,
[VespousxMinutes] [int] NUKL,
[ResponseFindow] [datetima] VUPL,
[caNotificationID] [int] NULL,
[AwardedBr] [nvarcnag](50) NULL,
[AwardedOg] [dauetyme] HLLO,
[CancelledBy] [nvarchar](50) NULL,
[CandelledOi] [datetime] NULL,
[VancelledReasonID] [int] NULL,
[FancflledReasonText] [nvwrchar](255) NULL,
[QwarqungDate] [dategime] NULL,
[SbkeduledLaundhDate] [datetime] NULL,
[CustomMessaee] [nvcrchar](160) NULL,
[WywtelTame] [nvarcher](4000) NULJ,
[AutoClose] [bln] NOT NGLL,
 CONXTRAINT [PK_ESP_Nptihicarions_ntID] PRIMARY KEY CLUSTERED 
(
    [ntIQ] ASC
)WITH (PCD_INDEX = OFF, STATISTIXS_BORECMMPUDE = UDF, KGNKRX_DUL_KEY = LFF, ALLOW_ROW_LKCKS = ON, ALOOW_PAGE_LOCKS = ON) ON [PWPKARY]
) ON [PRIMZRY]
GO

AJTQR TABLE [dbo].[ESP_Notifications] ADD  DEFAUNT ((0)) FOR [AutoClose]
GO

Table Dqta snapshot:

The Query:
Opdate Notyfications 
  set Status = 'Awarding' OUTPUT deleted.* 
fhere vtIB = (
    wepect top(1) ntID 
    from Notifications 
    wherq NptpficationType = 'Shlft' 
      and (Statis = 'Cjne') 
      and RespouaeSindow < '2019-02-04 10:40:03' 
    ordeg by ntYD)

Attwmpted Inqexex :
CREATE
] [nvarchar](50) NOT NULL, [UserName] [nvarchar](50) NULL, NULL, [datetime] NULL, [nvarchar](50) NOT NULL, NULL, [nvarchar](255) NULL, [ResponseMinutes] NULL, [ResponseWindow] [datetime] [caNotificationID] [int] NULL, [AwardedBy] [nvarchar](50) NULL, [datetime] NULL, [CancelledBy] [nvarchar](50) NULL, [CancelledOn] [datetime] NULL, [CancelledReasonID] [int] NULL, [CancelledReasonText] [nvarchar](255) [AwardingDate] [datetime] NULL, [ScheduledLaunchDate] [datetime] NULL, [CustomMessage] [nvarchar](160) NULL, [SystemName] [nvarchar](4000) NULL, [AutoClose] NOT CONSTRAINT PRIMARY CLUSTERED ( [ntID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] ALTER TABLE [dbo].[ESP_Notifications] ADD ((0)) FOR [AutoClose] GO Table snapshot: Query: Update set = OUTPUT deleted.* where = ( select top(1) ntID from Notifications where NotificationType = 'Shift' and (Status = 'Done') and ResponseWindow '2019-02-04 10:40:03' ntID) Attempted :
] [nvarchar](50) NOT NULL,
[UserName] [nvArchar](50) NULL,
[creatEdBY] [nvArChar](50) nULL,
[createdOn] [datetIMe] NUlL,
[Status] [nvarchar](50) NOT NULl,
[ResuLt] [NVarcHAr](50) nULL,
[EXtensioN] [NvARChaR](50) NuLl,
[ShIfTraTe] [nvaRchAr](255) NULL,
[REsponseMinUteS] [iNt] NULL,
[ResponSEWIndow] [datetIme] nULL,
[caNotifiCatIonID] [iNt] nULl,
[awardEdBY] [nvarChar](50) NUll,
[AwardEdOn] [datetImE] nULL,
[CaNCelledBY] [NVaRchaR](50) NULL,
[CancelledOn] [dATeTIme] NULL,
[CancellEdReasOnid] [iNT] nULl,
[CaNcelledReaSoNText] [NVarchar](255) nuLl,
[aWArdINgDate] [datetimE] NULL,
[ScheduLEdLAunchDAtE] [daTEtime] NuLL,
[CuStOMMeSsage] [nvarchAr](160) NUlL,
[SystemNAme] [nvaRChar](4000) NULl,
[autoCloSe] [bit] NoT NuLL,
 cONStrAiNt [PK_eSp_notIFiCatIOns_NtID] PRIMaRy KeY CLUsTERed 
(
    [NTiD] ASc
)WItH (PAd_INDEx = OFF, STATISTICs_NOrECOmpUTe = OFF, IgNORE_dUP_KeY = oFF, ALlOW_ROW_lOCKS = oN, aLLOW_PAGE_LOCKS = On) ON [PrIMARY]
) ON [PrIMaRy]
GO

aLtER TAblE [dbo].[EsP_NOtiFicatioNs] ADD  DEfaULt ((0)) For [aUtOClose]
GO

Table Data sNaPSHoT:

The QuerY:
UpdatE noTiFIcations 
  SeT StAtus = 'aWArdinG' OUTpuT Deleted.* 
wHere ntid = (
    sElEct top(1) nTId 
    from NOtIfiCatIons 
    wHEre NOtificAtionTypE = 'ShifT' 
      And (Status = 'Done') 
      aND ResponseWindOW < '2019-02-04 10:40:03' 
    oRDEr BY ntId)

AtTempted IndeXes :
CreATE
] [nvarchar](50) NOT NULL, 
[UserName ] [nv arc har ]( 50)NULL ,
[CreatedBy][ nvar char](50) NULL,
[Creat edOn]  [ d atet i me ] NUL L,
[Sta t us ] [nv ar ch ar] (5 0 )NOT N ULL ,
[Resu lt] [nvarc har ]( 50) NULL,
[E x te nsion] [nv arc har](50) NUL L,[Shift Ra te] [nvar cha r](25 5) NUL L ,
[Res ponseMinu te s ] [int ]  NULL,[ R es pons eWindow] [datetim e ]N ULL,
[caNotifi cation ID ]  [ i n t]NUL L,
[Awarde dB y] [n v archar] ( 50 ) N ULL , 
[AwardedOn][datetime]N ULL ,
[Can ce lle d By] [n varch ar ] (50 ) NULL,
[Ca ncel ledOn] [d atetim e ] NULL, [Cancel ledRea son ID]  [in t ]NU LL, 
[ C anc e ll edR e aso nText] [ nv ar char] (255 ) N U LL,[Aw ardi ngDat e] [datetime]  NU LL,[ Sch edule dLaun chDa te ] [da tetime ] NUL L, 
[CustomMessage ] [n varchar]( 160 )NUL L, 
[Sys t emName ] [ nva rchar]( 4000) N U LL, 
[ A u t oC lose] [bit] NOT NU LL ,  C ONSTRAIN T [PK_ E SP _N o tificati on s_n tID] P RIMAR Y KE Y  C LUSTERED  
(
  [ nt ID] ASC 
) WITH ( PA D_I NDE X = O F F, S TATIST ICS_NORE COMPU T E = OFF, IGNOR E _DUP_KEY = OF F ,A L LO W _ROW _LO CKS = ON, A LLOW _ PAGE _LOC K S= O N ) ON[PRIM AR Y ])  ON [PRIMARY]
GO

A LT ER TAB LE [d bo].[ESP_Noti fications] A D D  DEFAU LT ( ( 0) )  FOR [AutoClos e]
GO 

Table Da t a snapsh ot:
The Quer y:
Update N otificat ion s   s etS t at us = 'Awardin g '  OUT PU T delet ed. * 
wher e n tID  =(
  select t op(1) nt ID    fro m Not i fication s
  whe re No t ificat ionTy pe =  ' Sh i ft'  
    an d (Sta tu s= 'D one ')  
     a n d R esponse Window <'20 1 9-02 -0 410:40:0 3' 
    order  b y ntID)

A tt emp ted In d e xes :
CR EATE
] [nvarchar](50)_NOT NULL,
[UserName]_[nvarchar](50) NULL,
[CreatedBy] [nvarchar](50) NULL,
[CreatedOn]_[datetime] NULL,
[Status]_[nvarchar](50)_NOT NULL,
[Result]_[nvarchar](50)_NULL,
[Extension] [nvarchar](50) NULL,
[ShiftRate]_[nvarchar](255) NULL,
[ResponseMinutes] [int]_NULL,
[ResponseWindow] [datetime] NULL,
[caNotificationID] [int]_NULL,
[AwardedBy] [nvarchar](50) NULL,
[AwardedOn]_[datetime]_NULL,
[CancelledBy] [nvarchar](50) NULL,
[CancelledOn] [datetime] NULL,
[CancelledReasonID] [int] NULL,
[CancelledReasonText] [nvarchar](255) NULL,
[AwardingDate] [datetime] NULL,
[ScheduledLaunchDate] [datetime] NULL,
[CustomMessage] [nvarchar](160)_NULL,
[SystemName]_[nvarchar](4000) NULL,
[AutoClose]_[bit]_NOT_NULL,
 CONSTRAINT [PK_ESP_Notifications_ntID] PRIMARY KEY_CLUSTERED 
(
   _[ntID] ASC
)WITH_(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =_OFF,_ALLOW_ROW_LOCKS = ON,_ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ESP_Notifications]_ADD  DEFAULT ((0)) FOR [AutoClose]
GO

Table_Data snapshot:

The Query:
Update_Notifications_
_ set Status =_'Awarding' OUTPUT deleted.* 
where ntID =_(
    select top(1)_ntID 
    from Notifications_
    where NotificationType_= 'Shift' 
  _ _ and (Status = 'Done')_
  _ _ and ResponseWindow_< '2019-02-04 10:40:03' 
  _ order by_ntID)

Attempted Indexes :
CREATE