/
SQL Scripts

SQL Scripts

Check for non-integer OrgProfileField values Service At Sea 

SELECT * FROM [MarineLMS_Live].[dbo].[OrgProfileValues] where efField_Id='7D3FC972-B6EB-11E4-80CE-0CC47A025D51' and ISNUMERIC(ValueString) <> 1 order by ValueString

Check if there are any TimerEntries for EventNotifications with Expiration AFTER event Start

This should never be the case.

SELECT ev.Id as EventId, en.Id as EventNotificationId, rbt.Start, te.Expiration, en.NotificationTemplateName
  FROM dbo.Events as ev
  join [dbo].[EventNotifications] as en on en.EventId = ev.Id
  join dbo.Bookings as b on b.Id = ev.efBooking_Id
  join dbo.ResourceBookings as rb on b.Id = rb.efBooking_Id
  join dbo.ResourceBookingTimeSpans as rbt on rb.Id = rbt.ResourceBooking_Id
  join [dbo].[TimerEntries] as te on te.CallbackValue = en.Id
where ev.IsPublished = 1 and rbt.Start < te.Expiration