sql - replace multiple values at the same time - in order to convert a string to a number -
I am trying to convert a varchar field to a number, however, one of the common characters within that field I have to be successfully removed in order to convert it to numerical sets.
The field name UKSellPrice1
I need to convert it from USSLPRIC 1 to the following string in numeric:
'00' '' ' '' '' $ '' #n / a ' How can I do this?
At this time I have the following: < Previous> ; (Select Style Style Code, Color Code, UK SLEERPR 1 = Case when Chardix ('00', UK SLPRIIC1, 1) & gt; Re-Place (UK SLPRIC1, '.00', ' 'ELSE UKSellPrice1 END, UKSellPrice2 FROM dbo.RangePlan) SELECT * FROM R0
I Replace (replace, 'col', '$'), ''). , 'One pound', ''), 'n / a', '')
and so on.
The second is try to change the first digit and from there. It requires complex logic with patindex () . An example of: select cast (left (substring (col, patindex ('% [0-9]%', col), 1000), petindex ('% [^ 0- 9]% ', substrings (col, petandex ('% [0-9]% ', cola), 1000)) - 1) In the form of int) < / Html>
Comments
Post a Comment