Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to remove specific characters from SQL Server Column [closed]

I have a database table that contains a column for pricing.

Its very old, so it was written before i understood datatypes. so we are using varchar for a money value.

Ive noticed some columns have $ in them, so what I'm wondering is... is there a way with SQL Server to perform an update of the table and remove any instances of non numeric characters or at the very least remove the $ from the string in the columns in one go ?

I hope this is possible.

like image 810
user125264 Avatar asked Mar 20 '23 07:03

user125264


1 Answers

Update tbl
SET price = replace(price, '$', '')

Here is the replace definition

like image 108
Shantanu Gupta Avatar answered Mar 22 '23 19:03

Shantanu Gupta