sql server 2005 - How to write a CASE WHEN statement with multiple DATEDIFF variables -


Text after "

I have to calculate the difference between two dates (facility_start_date, facility_end_date) for a report in the Reporting Services in SQL 2005 then If facility_end_date is zero, then report parameter @EndDate is required to be used in the calculation, however, if feature_and_date is more than parameter @EndDate, then it will also have to use parameter @edendet for the code below if the facility_end_date parameter @end.date it still Land, except rather than facility_start_date and calculating between facility_start_date and facility_end_date between @EndDate works fine. Any help would be appreciated.

  In case of convenience_start_date & gt; Feature_and_date when tap tomorrow's date (day, convenience_start_data) & gt; DatePart (day, facility_end_date) then DateDiff (d, facility_start_date, IsNull (facility_end_date, @EndDate)) - 1 when the DatePart (day, .facility_end_date) & gt; DatePart (day, @EndDate) then DateDiff (d, facility_start_date, @EndDate) - 1 and DateDiff (d, facility_start_date, IsNull facility_end_date, @EndDate)) End  

< Div class = "post-text" itemprop = "text">

  case when rpt_critical_info_view.facility_start_date & gt; Rpt_critical_info_view.facility_end_date Zero when rpt_critical_info_view.facility_end_date is zero or DatePart (day, rpt_critical_info_view.facility_end_date) & gt; Date Format (DAY, @EndDate) and dated (D Arpiteepiartiai_info_wu. Fsiti_stat_det, @ Andedet) - 1 Ielsi Dedifif (D Arpitisiartiai_anfo_wu. Fsiti_stat_det, Arpiteepiartiai_aifo_av.afsiti_and_det) ED  

I do not 100 I'm% clear on what you expect to be the result. You are evaluating debt offsets, not offset the date. With your DATEPART function, 05/31/2010 will evaluate as 06/16/2010 I am also not sure why you are deducting 1 from the result of your DATEDIFF if you actually calculated the DATE votes If you are trying to do, use it:

  case when rpt_critical_info_view.facility_start_date & gt; Then zero rpt_critical_info_view.facility_end_date when rpt_critical_info_view.facility_end_date faucet or rpt_critical_info_view.facility_end_date & gt; Date format (DAY, @EndDate) was then dated (D, RPTPRTI_info_view.philiti_start_date, @EndDate) - 1 ELSEDDIFIFIF (D, RPTCRTI_EFFO_viewFACT_STAT_DATE, RPTCRTI_INF_viewFACT_and_DATE) ED  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -