SQL Remove all leading zeros
UPDATE pol
SET pol.Policy_Number = src.Policy_Number
FROM Policy_Table pol
INNER JOIN SourceTable src
on pol.Policy_Number =replace(ltrim(replace(src.Policy_Number,'0',' ')),' ','0')
Remove Leading Zeros in a column in a sql server table,
So adapt the query for an update
:
update table t
set ColumnName = substring(ColumnName, patindex('%[^0]%', ColumnName), 10);
Related Topics
Wamp Server Error [Local Server - 2 of 3 Services Running]
Sql Take Just the Numeric Values from a Varchar
Truncate Seconds and Milliseconds in SQL
How to Merge Rows on Specific Condition
I Want to Give Serial No in My Query According to Group
How Two Join to Tables Based on the Highest Value in One of Them
Pg_Restore: [Archiver] Unsupported Version (1.14) in File Header
Sql Count All Word Occurrences from a Table
How to Split a Comma-Separated Value to Columns
How to Retrieve Records for Last 30 Minutes in Ms SQL
How to Pass Multiple Values to Single Parameter in Stored Procedure
How to Round an Average to 2 Decimal Places in Postgresql
How to Directly View Blobs in MySQL Workbench
Select Ids from Multiple Rows Where Column Values Satisfy One Condition But Not Another
Find Employee Name Who Is Having Highest Salary in Given Month in SQL
Select Multiple Columns Count One Column and Group by One Column in One Table
Remove Blank Line in Between Select Queries When Spooling to CSV File