Splunk Search

How to get rid of white spaces in the column names when working on DB.?

SanthoshSreshta
Contributor

Hi

when I am trying to get the results from the DB (SQL Server), there are some column names as "Show Room Code".

The query i am using to get the results is:

| dbquery "Centro" "SELECT TransTime,Quantity,Amount,Show Room Code FROM Centro_Daily_Dummy" limit=1000

Then it is showing it as error : command="dbquery", A database error occurred: Incorrect syntax near 'Code'.
if the query is edited without Show Room Code then it is running correctly.
There are white spaces in the column name in the DB. how to get such columns in Splunk.

Thanks,
Santhosh

0 Karma

woodcock
Esteemed Legend

Try single-quotes like this:

| dbquery "Centro" "SELECT TransTime,Quantity,Amount,'Show Room Code' FROM Centro_Daily_Dummy" limit=1000
0 Karma

SanthoshSreshta
Contributor

Hi @woodcock
Sorry for the late reply.
and it is not displaying the values of showroomcode, instead it is been displaying Show Room Code string in each Row.

0 Karma

manunairadavakk
Path Finder

@SanthoshSreshta

I am also the same issue with table name. My table name has spaces in it.
Was your issue resolved ?

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...