|
Hi, Thanks in advance..
(comments are locked)
|
|
Your question is the same as this one so the answers will apply to your situation http://ask.sqlservercentral.com/questions/73911/query-to-select-a-string-between-two-known-strings
(comments are locked)
|
|
As I posted several times on this site, the easiest way to solve such scenarios is to use the CLR RegEx implementation. You can take a look on the sample implementation of CLRRegEx on my site: SQL Server 2005 and SQL Server 2008 Regular Expressions and pattern matching Using the sample implementation you can receive result by simple query using a simple regular expression:
(comments are locked)
|
|
IN THE REQUIREMENT YOU MENTIONED THE CHAREACTER 1 IS AT TWO PLACES, IF THE CHARACTER 1 IS PRESENT AT THREE PLACES MEANS THEN HOW DO YOU WANT YOUR SUBSTRING, 1 -- SUBSTRING BETWEEN 1ST 1 AND 2ND 1 2 -- SUBSTRING BETWEEN 1ST 1 AND 3RD 1 LIKE ''1:12.81:3:4' THEN HOW DO YOU CONSIDER I think that's not the issue with this requirement.Is there any logic to get the mth & nth occurence of a character in a string by using a single select statement with out using other usd fun?.
Jul 19 '11 at 09:21 PM
nidheesh
check it out this one, select SUBSTRING('1:12.85:3:4',len('1:12.85:3:4')-charindex('1',reverse('1:12.85:3:4')),1)
Jul 20 '11 at 12:50 AM
Naveen Kumar
select SUBSTRING('1:12.85:3:4',len('1:12.85:3:4')-charindex('1',reverse('1:12.85:3:4')),1) in the select if you want the occurances between ":" charachter just replace 1 with ":" in charindex function... hope this helps you...
Jul 20 '11 at 12:17 PM
Naveen Kumar
(comments are locked)
|

