title: Convert time part of datetime2 to decimal/float
body: <p>I am looking for a way to built criteria to search all midday dates in datetime2 field (including those having NULL value). In other words, time part must be equal to 0.5 or NULL.
  Here is what I tryied to find time number:</p>
  
  <pre><code>SELECT cast(GetDate() - DateDiff(day, 0, GetDate()) as decimal(4,4));
  </code></pre>
  
  <p>It gives me what I want, but when I pass it as criteria the following code fails with error</p>
  
  <p>"Operand type clash: datetime2 is incompatible with int":</p>
  
  <pre><code>SELECT tbl_OrderDetailsSub.OrderDetailsSubID, ProcessedDate 
  FROM tbl_OrderDetailsSub INNER JOIN tbl_OrderDetailsSubPl 
  ON tbl_OrderDetailsSub.OrderDetailsSubID = tbl_OrderDetailsSubPl.OrderDetailsSubID 
  INNER JOIN tbl_OrderDetails ON tbl_OrderDetailsSub.OrderDetailsID = tbl_OrderDetails.OrderDetailsID 
  INNER JOIN tbl_Order ON tbl_OrderDetails.OrderID = tbl_Order.OrderID 
  INNER JOIN tbl_Tooling ON tbl_OrderDetailsSubPl.TID = tbl_Tooling.TID LEFT OUTER JOIN tbl_ProdAct ON tbl_OrderDetailsSub.OrderDetailsSubID = tbl_ProdAct.ODSubID
  WHERE (((tbl_Order.ProdTypeID)&lt;&gt;'S' Or (tbl_Order.ProdTypeID) Is Null) 
  AND ((tbl_Order.CancelledDate) Is Null) 
  AND ((tbl_Order.RefusingReason) Is Null)
  
  AND (cast(isnull(ProcessedDate - DateDiff(day, 0, ProcessedDate),0.5) as decimal(4,4))=0.5)
  
  AND ((tbl_Order.OrderType)&lt;&gt;'Pasiūlymas') 
  AND ((tbl_Order.ShippedDate) Is Null));
  </code></pre>
  
  <p>I feel it is somehow related with <strong>IsNull</strong> function but cannot clarify it. I also tryied this line</p>
  
  <pre><code>AND (cast(ProcessedDate - DateDiff(day, 0, ProcessedDate) as decimal(4,4))=0.5 OR ProcessedDate is null)
  </code></pre>
  
  <p>... but got same error.</p>