title: Expected: System.Int32, got System.Decimal
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2601620/why-does-select-scope-identity-return-a-decimal-instead-of-an-integer">Why does select SCOPE_IDENTITY() return a decimal instead of an integer?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm using following code to determine last inserted id on my column</p>
  
  <pre><code>var sql = "SELECT IDENT_CURRENT('TableName')"; 
  var query = session.CreateSQLQuery(sql); 
  var lastInsertedId = query.UniqueResult(); 
  </code></pre>
  
  <p>But when I'm try to use these id value </p>
  
  <pre><code>photo.Property = session.Load&lt;Domain.Property&gt;(lastInsertedId);
  </code></pre>
  
  <p>I got following error message
  <strong>Provided id of the wrong type. Expected: System.Int32, got System.Decimal</strong></p>
  
  <p>How can I overcome these ? Thanks</p>