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
 General SQL Server Forums
 New to SQL Server Programming
 Extract substring from string(Regular Expressions)

Author  Topic 

jeusdi
Starting Member

27 Posts

Posted - 2008-02-11 : 04:23:25
Hello forum, I need extract a substring form a string that follows a regular expressions -->

T:1º/PQ:1/TALLA:2(MOD.51 100/150)

T:<number>º/PQ:<number>...

I need to extract only the numbers. The SUBSTRING functions is insuficient for me, because in some cases de number can be 1, 10, 100, 1000, ...

I would like me use it as:
SELECT RegularExpression (Field)

Can you help me, please.
Thanks for all in advanced. I will appreciate a lot your help.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-11 : 04:37:02
Which numbers? There are several.
And why do you think SUBSTRING in conjunction with CHARINDEX is insuffficient?


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-11 : 05:12:33
quote:
Originally posted by Peso

Which numbers? There are several.
And why do you think SUBSTRING in conjunction with CHARINDEX is insuffficient?


E 12°55'05.25"
N 56°04'39.16"



SUBSTRING without CHARINDEX is insuffficient

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-11 : 05:20:55
You could make this

SUBSTRING(Col1, 1 + ABS(CHECKSUM(NEWID())) % LEN(Col1), 1)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -