title: SQL Server : how to split a string using a comma as a separator
body: <p>I need to populate columns in my database for Latitude and Longitude, however the original information is stored as a single string</p>
  
  <p>eg.</p>
  
  <pre><code>UDFChar1 = 41.243223,-8.183913
  </code></pre>
  
  <p>I am guessing that the TRIM command will come in useful here, but I do not know how I can tell it to stop exactly on the comma for each half.</p>
  
  <p>What I'm hoping to be able to come up with is a simple UPDATE query as per the below:</p>
  
  <pre><code>UPDATE Asset
  SET Lattitude = (SELECT LTRIM(UDFChar1)),
  Longitude = (SELECT RTRIM(UDFChar1))
  </code></pre>
  
  <p>but obviously with some extra work in the LTRIM and RTRIM parts so that I am only selecting the data up to, and not including the comma in UDFChar1</p>
  
  <p>Any ideas on how to achieve this?</p>