title: Convert Integer value into Hour value (AM / PM) in SQL Server
body: <p>I have a <code>table</code> with hour <code>values</code>. I need to convert the hour value into <code>AM/PM</code> format, as shown here:</p>
  
  <pre><code>val   hour 
  ---------------
   9     9:00 AM
  19     7:00 PM
  10    10:00 AM
  19     7:00 PM
  14     2:00 PM
  </code></pre>
  
  <p>I have tried this logic:</p>
  
  <pre><code>declare @timing varchar(5)='15:02'
  
  declare @time time=cast(@timing as time)
  select convert(varchar(50),@time, 100)
  </code></pre>
  
  <p>But this requires <code>val</code> to be converted into <code>varchar</code>. Is there any other way or inbuilt function available in SQL Server to do this?</p>