title: Alter MySQL table varchar fields to decimal fields
body: <p>I have a MySQL-table with several colomns like</p>
  
  <pre><code>id  text_1  val_1   text_2  text_3  val_2
  1   'bla'   1,23    'blub'  5,67    12,34
  </code></pre>
  
  <p>Unfortunately all fields are defined as <code>varchar</code>. Now I try to alter the table to make some fields decimal values.</p>
  
  <p>I would try</p>
  
  <pre><code>UPDATE table SET
  val_1 = CAST(val_1 AS DECIMAL(5,2)),
  val_2 = CAST(val_2 AS DECIMAL(5,2));
  </code></pre>
  
  <p>This should give me decimal values with two decimals and a max value of 999,99, correct?</p>
  
  <p>And is this the correct way to alter the table structure? This should be a one time conversion, as values should get da decimal type and strings should be varchar type.</p>
  
  <p>Do I have to convert the 'comma' to 'point' first?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Unfortunately I have also values like `&lt;0,01'. But the field should be a decimal field. What can I do with that?</p>