title: SQL Datename within a function
body: <p>I'm having issues when trying to get a datename Month within a conversion.</p>
  
  <p>My current query is used to check the time a Trolled passed 'South Shop' however I now require the query to take the conversion then display me the month only.</p>
  
  <p>Current query snippet:</p>
  
  <pre><code>dbo.fn_ConvertUTCtoShopDateTime( Visit.ORGID,
          dbo.fn_GetTrolleyreportcrossingafter ( Visit.ORGID
  
                                          ,Visit.Trolley_ORGID
                                          ,'South Shop'
                                          , TrolleyMovement.ActualStartDateUTC
                                          , 90
                                         ))                                     AS [Month2],
  </code></pre>
  
  <p>I understand I can use Datename(mm, but I'm having issues when inserting it into the query.</p>
  
  <p>any assistance would be fantastic</p>
  
  <p>Update-----
  The answer was the following:</p>
  
  <pre><code>Datename(mm, (dbo.fn_ConvertUTCtoShopDateTime( Visit.ORGID,
          dbo.fn_GetTrolleyreportcrossingafter ( Visit.ORGID
  
                                          ,Visit.Trolley_ORGID
                                          ,'South Shop'
                                          , TrolleyMovement.ActualStartDateUTC
                                          , 90
                                         ))                                     AS [Month2], 
  </code></pre>
  
  <p>I apologise for my idiocy</p>