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
 regex in mssql ?

Author  Topic 

turj
Starting Member

6 Posts

Posted - 2007-11-20 : 13:36:28
hello people,
I have a table with some field named 'f1', the filed contains string like this:

1:3-12/23.2:3-23/12.78:4-12/11
and so on with the same format...

I need to write some sql query that extracts all the first one or two numbers that appears before the ':' (all the red numbers in the example above). I don't mind if I get the result as a set of rows or a string that contains all the (red) numbers.
is it possible with mssql?

thanks.

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-11-20 : 14:01:05
Read about User Defined Functions in Books OnLine -- you can create a function that will accept the string as an argument, parses it, and then returns back what you want.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

turj
Starting Member

6 Posts

Posted - 2007-11-20 : 16:08:45
I know about stored procedures, but I don't know how to accomplish this specified task. I need to use regular expression and stuff..
maybe some example would help me..
Go to Top of Page
   

- Advertisement -