title: How to compare only year from a datetime field in sql server 2008?
body: <p>I have a table containing a datetime column named:</p>
  
  <pre><code> TranDate
  </code></pre>
  
  <p>So, I have to query through the table to get the data depend on the year only. So,
  I am little bit confused about how to do this. My current sql query is:</p>
  
  <pre><code> select * from Angkasa_UnpostedRecords 
   where year(convert(datetime,TranDate,103) = year(convert(datetime,@FromDate,103)
  </code></pre>
  
  <p>But I am getting error in this. Please suggest me how can I do this.</p>
  
  <p>Thank you.</p>