Replace charatype type in string by Integer

Posted by ALOK under Sql Server on 4/16/2013 | Points: 10 | Views : 1026 | Status : [Member] | Replies : 3
STRING STR="Hello123howRu";
i want to replace all character with integer value.
provide me sql query.

ex: Hello123howRu should be replace by 5555512355555

Thanks & Regards,
Alokssm



Responses

Posted by: Satyapriyanayak on: 4/16/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
UPDATE emp
SET name = REPLACE(name, 'Hello123howRu', '5555512355555')

If this post helps you mark it as answer
Thanks

ALOK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: ALOK on: 4/16/2013 [Member] Starter | Points: 25

Up
0
Down
i have to replace character type to integer value..

it is not necessary that hello will come always..

Thanks & Regards,
Alokssm

ALOK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 4/16/2013 [Member] Starter | Points: 25

Up
0
Down
You have to create a table valued function to achieve this...
Pass string in that function as parameter and character you want to replace if any number is found.

http://hashtagakash.wordpress.com/

ALOK, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response