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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...