title: I need to avoid value less than ZERO, what should I have to make change in the query to get null if value of output is less than Zero
body: <p>This is SQL query for the data, I need to avoid value less than ZERO, what should I have to make change in the query to get null if value of output is less than Zero</p>
  
  <pre><code>SELECT 
      deviceID,
      SUBSTRING(data, 1,2) AS Device,
      SUBSTRING(data, 3,2) AS Device_Status,
      udf.test1(data) as Energy_TOT,
      udf.test2(data) as PWR,
      DATEADD(hour,4,EventEnqueuedUtcTime) AS ts
  INTO [IOThuboutput]
  FROM [IOThubinput]
  </code></pre>