Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep just Numbers (Easy Question) 1

Status
Not open for further replies.

RovirozM

Technical User
Joined
Dec 9, 2009
Messages
37
Location
MX
Hi Guys,

Does any one of you knows if there exist a function that do this?

I have this field:

X = "ABCD123Y"

I would like to change it to this:

X = "123"

I mean eliminate all the "Not Numbers" and leave just the numbers in that place.

Does a T-SQL Function exist for this? or I have to create something here?

Thanks a lot for any help!

MR
 
Hi gmmastros,

It is a good blog and very good function.

I tried and almost work for me.... I just found this value that doesn't work for my neededs:

('PACU-882065,,')

the "-" is not a minus sign here, is something that I have to delete....

Thanks for your help.
 
The function contains 3 instances of: %[^0-9.-]%

To remove -, remove it from the code.
To remove ., remove it from the code.

So:

[!]%[^0-9]%[/!]

Make sure you replace all 3 instances of the pattern match.


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top