Link to home
Start Free TrialLog in
Avatar of emailamos
emailamos

asked on

Striping out text within a double quote MS SQL

I'm trying to strip out text (+BAT_MATFXOPT+BAT_MATUPD) from one of the row   MultiFilterNames:"+BAT_MATFXOPT+BAT_MATUPD" DelivMonth:(|TF_DTRNG| ()) FXValueDate:(|TF_DTRNG| ()) FilterAttributesXML:"<FilterAttributes></FilterAttributes>" ) within double quote right after MultiFilterNames:


Thanks



MultiFilterNames.xls
SOLUTION
Avatar of ketansoneji
ketansoneji
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of emailamos
emailamos

ASKER

Have a look at the attachment, it doesn't always return in that format after the quote.
try the below:
just replace yourcol, with your actual column name.

select
	stuff(	
		yourcol, 
		charindex(yourcol, '"'),
		charindex(yourcol, '"', charindex(yourcol, '"') + 1),
		''
		)
from yourtable

Open in new window

or you can actually simplify it a bit considering that all rows start with "MultiFilterNames:"

select
	stuff(	
		yourcol, 
		18,
		charindex(yourcol, '"', 19),
		''
		)
from yourtable

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try this after u create the function

SELECT dbo.CustomFunc('MultiFilterNames:"+BAT_MATFXOPT+BAT_MATUPD" DelivMonth:(|TF_DTRNG| ()) FXValueDate:(|TF_DTRNG| ()) FilterAttributesXML:"<FilterAttributes></FilterAttributes>" )')
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ralmada... u  r correct.