Remove last digit from a numeric value in a column if only the value has 4 digits
<p>I would like to remove the last digit from a numeric field/value from an entire column only if the value has 4 digits either using SQL or Python.
Example:
Column name is Credit Score
Table name is T1
Example values are 888 and 8880, I would like to remove any values with 0 at the end but only if has 4 digits, as some values are like 740 and 7400.</p>

<p>Thank you,</p>

<p>I tried to implement your needs on SQL Azure, please try to use the sql below.</p>

<pre><code>update tablename
set credit_score = cast(replace(rtrim(replace(cast(credit_score as varchar), '0', ' ')), ' ', '0') as int) 
where credit_score &gt;= 1000
</code></pre>

<p>For example: 7400 => 74, 70400 => 704</p>

python sql sql-server azure