All Apps and Add-ons

Using DB connect to pull data and need to replace "" quotes in a string.

1337du0
New Member

Here is my query:

SELECT REPLACE([TEXT],'"','''') as EVENT from DB_name

This version of the query works in the DB connect editor, but does not work when saved as a job.

Adding an escape character:
SELECT REPLACE([TEXT],'\"','''') as EVENT from DB_name
Allows the query to work when saved, but does not replace the quotes at all.

I am trying to use a simple query that works in SQL. What am I missing?

0 Karma

rikro
New Member

Try using the CHAR() function which can be used to set a single ANSI character in your code. E.g. CHAR(34) will print a single double-quote ". To come up with ANSI codes, you can also use ANSI('"').

For your problem, you can use:
SELECT REPLACE([TEXT], CHAR(34) ,'''') as EVENT from DB_name

This should work on most database systems...

0 Karma
Get Updates on the Splunk Community!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...