March 22, 2007 at 2:01 pm
Hello all,
i have the following question,
in a database field auxdata (ntext 16), i have text between brackets that i want to retrieve:
how can i become a string that contains "ABCDEFGHIJK"?
Thx in advance
Steve
March 22, 2007 at 2:24 pm
Try
CHARINDEX ( expression1 , expression2 [ , start_location ] )
March 22, 2007 at 2:48 pm
hi,
i have tried:
SELECT (substring(auxdata,charindex('',auxdata),
(charindex('',auxdata) - charindex('',auxdata)))
FROM workitem
but he gives me errors..
i just need a return value as a string
March 22, 2007 at 2:57 pm
Remove the first left parenthesis after SELECT.
March 22, 2007 at 3:26 pm
SELECT substring(auxdata,
charindex('TAGmanager_nameTAG',auxdata),
(charindex('TAG/managerTAG',auxdata) - charindex('TAGmanager_nameTAG',auxdata)))
FROM workitem
where (id='53')
This thing gives me following result:
TAGmanager_nameTAG MR XXXX TAG/manager_nameTAG
But what i do need is just the info between the 2 tags here above
Thx
March 22, 2007 at 4:16 pm
How about:
declare
@auxdata varchar(100)
set
@auxdata = 'TAGmanager_nameTAG MR XX TAG/manager_nameTAG'
SELECT
substring
(@auxdata,
charindex
('TAGmanager_nameTAG',@auxdata) + 18,
(
charindex('TAG/manager_nameTAG',@auxdata) -
(
charindex('TAGmanager_nameTAG',@auxdata)+ 18)))
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply