I have in my sql table different kinds of barcodes.
My Barcodes starting with 0 example
05212365489787
0000000290098
0000000000103
I want to remove all starting 0 from my barcodes.
Example result want to be:
5212365489787
290098
103
I found this Code: But i want to update them:
select SUBSTRING(str_col, PATINDEX('%[^0]%', str_col+'.'), LEN(str_col)) from table1
something like that
update table1 set Barcode =(SELECT SUBSTRING(Barcode, PATINDEX('%[^0 ]%', Barcode + ' '), LEN(Barcode)) FROM table1 )
but i get error Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.