October 4, 2004 at 5:14 am
is there any function in sql server 2000 to find the position of a specified string
like i want to find "|" in this string--> 80339inesh|80339:dinesh badgujar|80339:dinesh badgujar
it is 13th
is there anything like that ??
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
October 4, 2004 at 5:19 am
Have you looked at CHARINDEX ?
/Kenneth
October 4, 2004 at 5:35 am
it gives value 0, it always give value 0, it is deterministic function
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
October 4, 2004 at 5:46 am
Indeed...?
select charindex('|', '80339:dinesh badgujar|80339:dinesh badgujar')
-----------
22
(1 row(s) affected)
Doesn't look too deterministic to me...
/Kenneth
October 4, 2004 at 5:55 am
SELECT CHARINDEX('|', '80339inesh|80339:dinesh badgujar|80339:dinesh badgujar')
SELECT PATINDEX('%|%', '80339inesh|80339:dinesh badgujar|80339:dinesh badgujar')
Good Hunting!
AJ Ahrens
webmaster@kritter.net
October 4, 2004 at 6:19 am
use it with the column name
like
select charindex(rmlist,'|',1)
use it this way and see
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
October 4, 2004 at 6:33 am
HI, it will work with colum name as well, thing is you have the order of the variables backwards.
the first string is what your looking for, the second is what your searching so for instance
Select Eyecolor from Eyecolor
Where ('bl',eyecolor)>0
Yields 'Blue' and 'black'
Hope that helps
Tal McMahon
October 5, 2004 at 2:40 pm
Try to avoid regular expressions for obvious speed reasons, but when necessary or speed isnt an issue they are great. Here is a link to a way to use them from TSQL
http://www.codeproject.com/database/xp_pcre.asp
- john
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply