12 Replies Latest reply on Oct 11, 2018 10:18 AM by John Wagner

    Passing field values through to a custom sql query

    John Wagner

      I have an id field that represents the start and end date of an event.  I need to calculate the business days between the two dates excluding weekends and company defined holidays.  Is there way to pass the start date and end date to a custom SQL query. 


      This is the custom SQL statement


      use calendar

      declare @sDte as datetime,
              @eDte as DateTime

      set @sDte = '2017-06-07'
      set @eDte = '2018-09-12'



      select count (BusinessDay) as ttldays
      form Calendar
      where  (dte between @sDte and @eDte)
      and BusinessDay is not null