title: removing implicit conversion in SQL Server
body: <p>I am attempting to eliminate an implicit conversion from the database.</p>
  
  <p>I added the CAST statement below on the UpdatedByID field as this was a Char(10), it is joining to an INT in the FROM statement. But i'm still getting the Implicit conversions. I must be missing something obvious ??          </p>
  
  <pre><code>        SELECT DISTINCT ba.BookingID INTO #temp1
          FROM BookedItemsAudit_tbl bia  
          INNER JOIN BookingAudit_tbl ba ON bia.BookingAuditID = ba.BookingAuditID    
          INNER JOIN User_tbl u ON  u.UserId  = CAST(ba.UpdatedById AS INT)
          WHERE bia.BookedItemTypeId IN (1, 58, 60)   
          AND u.UserId = 5
  </code></pre>
  
  <p>here is the cut down schema</p>
  
  <pre><code>BOOKINGAUDIT_TBL
  Column_name     Type        Length
  BookingAuditID  int         4
  BookingID       int         4
  UpdatedByID     CHAR        10
  UpdatedBy       varchar     50
  UpdatedDate     datetime    8
  TotalMargin     money       8
  BookingStatusId int         4
  
   USER_TBL
   Column_name    Type        Length
   UserId         int         4
   FullName       varchar     100
   UserName       varchar     20
  </code></pre>
  
  <p>full query and schema in this link </p>
  
  <p><a href="http://sqlfiddle.com/#!6/3ca48/1" rel="nofollow noreferrer">SQL fiddle</a></p>
  
  <p>attached is the error message when the hint appears in the execution plan</p>
  
  <p><img src="https://i1308.photobucket.com/albums/s605/Chris_Damaged_Goods_Woods/implicitconversion_zpsbb396509.png" alt="Implicit conversion after casting to INT"></p>