This is a discussion on tsql Substring question within the SQL Server forums, part of the Microsoft SQL Server category; --> I am trying to find a way to dynamically retrieve the substring starting point of an nText field. My ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am trying to find a way to dynamically retrieve the substring starting point of an nText field. My query looks something like, SELECT ID,Substring(DOCTEXT,0,200) from mytable where DOCTEXT like 'claim%'" This query has the substring starting point set to 0. Is there a way to determine the starting point based on the first occurrence of the search term? If first occurrence of 'claim' is at 25th character then the query should start substring process at 25th and end at 225th character. I am trying to avoid usage of UDF. Is there a to handle this through plain SQL statements? Any help would be appreciated. TIA. |