Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Naughty Numbers

Author  Topic 

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2004-12-15 : 08:30:43
I have a field that is varchar, the text in the field will begin with 0 or more numbers (possibly a comma and a space) and then some text. Anyone have any idea how I can remove the numbers I can match single numeric digits but how do I match a complete integer?

e.g. I might have

This is some text
23, This is some more text
12345678, This is even more text

and I just want

This is some text
This is some more text
This is even more text

Many thanks

steve


To alcohol ! The cause of - and solution to - all of life's problems

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-12-15 : 08:35:55
SELECT SubString(col1, PatIndex('%[^A-Za-z]%', col1), 8000) FROM myTable

This will remove any leading non-alpha characters from the string.
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2004-12-15 : 09:28:33
Of course!! Why didn't I realise that!!!!!.

Many thanks

cheers


steve

To alcohol ! The cause of - and solution to - all of life's problems
Go to Top of Page
   

- Advertisement -