title: SSRS not inclusive for dates; While Management Studio is?
body: <p>Why is it that when I run the query in Management Studio with the following where clause, it returns the data correctly when the cash_date equals the parameter, FromDate.</p>
  
  <pre><code> FILMTRAN.cash_date &gt;= (@FromDate) AND
  </code></pre>
  
  <p>However, when I copy the same query to SSRS it no longer includes the data where the @FromDate equals the cash_date.  The user enters in the parameter in SSRS.  I even did a test where I displayed the full date including the time and did an if statement that returned "yay" if they matched or "no" if they did not.  Even according to SSRS, they match, but than why is my data not being returned when it occured on the same day?!  I am dumbfounded this is not working, when it clearly works in management studio.  </p>
  
  <p>I have even tried adding a dateadd function into my sql statement, which again responds correctly in management studio but not ssrs.</p>
  
  <p>Edit: I tested the >= using a much simpler 3 line query and it worked as intended but it is still not working for my query, which works in management studio but not SSRS.  So now I am thinking there is some very specific bug associated with something in my longer query which I have attached. To test my code in management studio I declare the variables as seen below.  However, I delete this code when I import my query into SSRS and instead create the parameters within SSRS(just as I have always done, with no problems).</p>
  
  <pre><code>DECLARE @FromDate AS DATETIME
  SET @FromDate = '1-Oct-2013'
  DECLARE @ToDate AS DATETIME
  SET @ToDate = '8-Apr-2015'
  DECLARE @Loan AS VARCHAR(20)
  SET @Loan = 'TAX_B'
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Vjj7I.png" alt="enter image description here"></p>
  
  <pre><code>SELECT distinct LOANMAST.loan, 
  CARDINDX.DESCRIPTION AS BorrowerName, 
  CARDINDX.contact_name,
  CARDINDX.in_care_of,
  --loan_ipt.interest,
  CARDINDX.mail_address1, 
  CARDINDX.mail_address2,
  CARDINDX.mail_city, 
  CARDINDX.mail_state,
  CARDINDX.mail_country,
  LOANMAST.closed_date,
  PROPERTY.STATE,
  CARDINDX.MAIL_ZIP_CODE, 
  PROPERTY.address1, 
  PROPERTY.address2,
  PROPERTY.city, 
  PROPERTY.ZIPCODE, 
  PROPERTY.country,
  FILMTRAN.cash_date, 
  CASE FILMTRAN.TRAN_SUBTYPE WHEN 'REGINST' THEN 'Regular Collections'
  WHEN 'PAC' THEN 'PAC'
  WHEN 'CORREST' THEN 'Group Collection'
  WHEN 'ESCROWTAX' THEN 'Tax Disbursement'
  WHEN 'SUNDRY' THEN 'Tax Refund'
  WHEN 'FULL PAY' THEN 'Payoff'
  END AS TRANSUBTYPE,
  FILMTRAN.TAX_ESCROW,
  FILMTRAN.TRANSACTION079,
  JK.taxescrowbalance,
  CASE FILMTRAN.TRANSACTION079 WHEN 'COLLECTION' THEN FILMTRAN.TAX_ESCROW
  WHEN 'DISBURSEMENT' THEN 0 
  END AS TAXESCROWCOLL,
  CASE FILMTRAN.TRANSACTION079 WHEN 'DISBURSEMENT' THEN FILMTRAN.TAX_ESCROW *-1
  WHEN 'COLLECTION' THEN 0 
  END AS TAXESCROWDIS
  
  FROM LOANMAST LEFT OUTER JOIN BORROWER ON LOANMAST.loan=BORROWER.loan
   LEFT OUTER JOIN LOANCOLL ON LOANMAST.loan=LOANCOLL.loan
   LEFT OUTER JOIN PROPERTY ON LOANCOLL.code=PROPERTY.prop_code
   LEFT OUTER JOIN BALHIST ON BALHIST.loan=LOANMAST.loan
   LEFT OUTER JOIN CARDINDX ON BORROWER.SHORT_NAME=CARDINDX.SHORT_NAME
   LEFT OUTER JOIN LOAN_IPT ON LOAN_IPT.short_name=CARDINDX.short_name
   LEFT OUTER JOIN FILMTRAN ON FILMTRAN.loan=LOANMAST.loan 
  JOIN (
   SELECT distinct FILMTRAN.loan, FILMTRAN.cash_date,  FILMTRAN.transaction079 ,FILMTRAN.tax_escrow,
  sum(FT.taxescrowcoll)+sum(FT.taxescrowdis)+isnull(BH.esc_tax_bal_p, 0) AS "TaxEscrowBalance" 
  from 
  FILMTRAN
  LEFT OUTER JOIN (SELECT loan, accounting_date, esc_tax_bal_p,
  rank () over (order by accounting_date desc) AS date_rank
   FROM BALHIST
   where loan = @Loan) BH ON BH.loan=FILMTRAN.loan
  JOIN 
  (
  SELECT loan, cash_date, 
  FILMTRAN.transaction079,
  CASE FILMTRAN.TRANSACTION079 WHEN 'COLLECTION' THEN TAX_ESCROW
  WHEN 'DISBURSEMENT' THEN 0 
  END AS TAXESCROWCOLL,
  CASE FILMTRAN.TRANSACTION079 WHEN 'DISBURSEMENT' THEN TAX_ESCROW *-1
  WHEN 'COLLECTION' THEN 0 
  END AS TAXESCROWDIS FROM FILMTRAN
  WHERE loan = @Loan)
  FT ON FT.loan=FILMTRAN.loan
  where FT.cash_date &lt;= FILMTRAN.cash_date 
  AND (BH.date_rank ='1' OR BH.accounting_date IS NULL)
  AND (len(FT.transaction079) &lt;= len(FILMTRAN.transaction079) OR FT.cash_date &lt; FILMTRAN.cash_date)
  GROUP BY FILMTRAN.loan,FILMTRAN.cash_date,  FILMTRAN.transaction079, FILMTRAN.TAX_ESCROW, BH.esc_tax_bal_p) JK ON JK.loan=FILMTRAN.loan AND JK.cash_date = FILMTRAN.cash_date AND JK.transaction079=FILMTRAN.transaction079
  
  WHERE 
  FILMTRAN.RVRS_REASON &lt;&gt; 'ERROR_CORR' AND
  Loancoll.prim_ind = 'Y' AND
  LOANMAST.loan_status &lt;&gt; '1_INQUIRY' AND
  LOANMAST.loan_status &lt;&gt; '2_APP_ISS' AND
  LOANMAST.loan_status &lt;&gt; '3_APP_ACC' AND
  LOANMAST.loan_status &lt;&gt; '4_APPROVED' AND
  LOANMAST.loan_status &lt;&gt; '5_COMMITTED' AND
  LOANMAST.loan_status &lt;&gt; '9_DELN_SLF' AND
  LOANMAST.loan_status &lt;&gt; '9_REJ_BRWR' AND
  FILMTRAN.cash_date &gt;= (@FromDate)
  AND FILMTRAN.cash_date &lt;= (@ToDate)
  AND LOANMAST.loan = @Loan
  AND FILMTRAN.tax_escrow &lt;&gt; 0
  </code></pre>