Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove charaters from String

Status
Not open for further replies.

NavMen

Vendor
Jul 6, 2004
35
NL
Hi,

I'm trying to remove some characters from my text string below, with Right I can remove the word CONTAINS(', How can I remove with the same query the characters ') on the end of the string.

CONTAINS('"court" OR "judicial" OR "case number"')

select Right(POL_QUERY, len(POL_QUERY)-CharIndex('''', POL_QUERY))
from STH_POLICY


I need only this part of the string "court" OR "judicial" OR "case number"

PS: the string has different length

Thanks,

/Navmen

 
Code:
DECLARE @test varchar(8000)
SET @test = 'CONTAINS("court" OR "judicial" OR "case number")'

SELECT REPLACE(REPLACE(@Test,')',''),'CONTAINS(','')


Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
Microsoft MVP VFP
 
Thanks for the answer, but the ' is still there

'"court"OR "judical" OR "case number"'

How to remove the leading and end ' from the string.

Thanks,

Navmen
 
Code:
DECLARE @test varchar(8000)
SET @test = '''CONTAINS("court" OR "judicial" OR "case number")'''

SELECT REPLACE(REPLACE(REPLACE(@Test,')',''),'CONTAINS(',''),'''','')

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
Microsoft MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top