title: Convert Salesforce IDs from 15 digit to 18 digit using sql code/function
body: <p>We are currently pulling in data from SalesForce to SQL Database tables.  There are 2 custom fields on different objects that were created for the Lead ID and a look up for which event/task is linked (this can be an account id, contact id, or lead id).  Both of these are pulling over the 15 digit ID.  </p>
  
  <p>I am trying to find out if there is any SQL code or a SQL function that will allow me to convert that 15 digit to an 18 digit ID.  </p>
  
  <p>I need to have that 18 digit ID to join back to the other objects.</p>
  
  <p>We have already tried using the <code>CASESAFEID(Id)</code> function in SalesForce, but with the API that was already set up and the visibility levels our particular ETL is not showing that field.  Also, we would need to get a consultant to mess with the look up column.</p>
  
  <p>I would like to take the 15 digit ID and convert it to the 18 digit code. If the SalesforceID is <code>0035000002tAzbu</code>, how do I get the converted 18 digit value to be <code>0035000002tAzbuACC</code>.  I need to get that last 3 digits using SQL query or SQL function.</p>