<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to pass input variable to dbxquery in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460318#M129864</link>
    <description>&lt;P&gt;OK one more try escape the backslashes in the query :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;splunk_server=ass index="ass_main" host=*pr
       | rex field=_raw "(?&amp;lt;EMPID&amp;gt;[0-9]{12})"
       | dedup EMPID
       | fields EMPID
       | stats values(EMPID) as EMPID
       | eval EMPID = "'".mvjoin(EMPID, "','")."'"
       | map search="| dbxquery query=\"select \\\"Employer Name\\\" PR, \\\"Employee Number\\\" EMPID FROM BIA_BA_EUL.\\\"View Employee Helpdesk\\\" WHERE \\\"Employee Number\\\" in ($EMPID$)\" connection=\"EMP-PR\"" 
       | fields EMPID,PR
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Sep 2019 06:39:49 GMT</pubDate>
    <dc:creator>thomasroulet</dc:creator>
    <dc:date>2019-09-05T06:39:49Z</dc:date>
    <item>
      <title>How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460291#M129837</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;

&lt;P&gt;I am struggling to pass inputs to my dbxquery.&lt;BR /&gt;
My intention is to display all EMPID and Employer name by passing EMPID as the parameter to my dbxquery.&lt;BR /&gt;
QUERY:&lt;BR /&gt;
splunk_server=ass index="ass_main" host=*pr &lt;BR /&gt;
| rex field=_raw "(?EMP[0-9]{12})"&lt;BR /&gt;
| dedup EMPID&lt;BR /&gt;
| fields EMPID&lt;BR /&gt;
| map search="| dbxquery query=\"select \"Employer Name\"  PR&lt;BR /&gt;
FROM&lt;BR /&gt;
BIA_BA_EUL.\"View Employee Helpdesk\" where \"Employee Number\" in $EMPID$\" connection=\"EMP-PR\"" | table EMPID,PR&lt;/P&gt;

&lt;P&gt;ERROR:&lt;BR /&gt;
Error in 'map' command: Unable to find saved search 'search='.&lt;/P&gt;

&lt;P&gt;Request for any inputs please&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:52:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460291#M129837</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2020-09-30T01:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460292#M129838</link>
      <description>&lt;P&gt;The error was removed when i changed my query to the below one. I am getting the expected number of events, but i need EMPID,PR to be displayed in a table&lt;/P&gt;

&lt;P&gt;splunk_server=ass index="ass_main" host=*pr &lt;BR /&gt;
| rex field=_raw "(?EMP[0-9]{12})"&lt;BR /&gt;
| dedup EMPID&lt;BR /&gt;
| fields EMPID&lt;BR /&gt;
| map search=" | dbxquery query=\"select \"Employer Name\" PR&lt;BR /&gt;
FROM&lt;BR /&gt;
BIA_BA_EUL.\"View Employee Helpdesk\" where \"Employee Number\"='$EMPID$'\" connection=\"EMP-PR\"" | fields EMPID,PR&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:52:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460292#M129838</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2020-09-30T01:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460293#M129839</link>
      <description>&lt;P&gt;Hi Experts,&lt;BR /&gt;
Request for some help/pointers for the above issue.&lt;BR /&gt;
Been struggling for a solution&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 00:12:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460293#M129839</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2019-08-26T00:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460294#M129840</link>
      <description>&lt;P&gt;Hello, in your |rex command, you are creating a field called EMP. Did you mean to make that variable called EMPID?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 05:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460294#M129840</guid>
      <dc:creator>nyc_jason</dc:creator>
      <dc:date>2019-08-26T05:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460295#M129841</link>
      <description>&lt;P&gt;@jschogel &lt;/P&gt;

&lt;P&gt;Not sure i am not able to write the rex command properly in the above problem statement&lt;BR /&gt;
My variable is EMPID extracted through rex.&lt;BR /&gt;
I have to pass the field EMPID as an input to the dbxquery and fetch employers name of only those EMPID obtained from first search&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 06:26:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460295#M129841</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2019-08-26T06:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460296#M129842</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;map command is limited by default for 10 searches.&lt;BR /&gt;
 after map command, the results (in your case) are the results of the SQL command, &lt;BR /&gt;
 so if you want to obtain EMPID and PR, you have to select this fields in your SQL command&lt;/P&gt;

&lt;P&gt;if EMPID is extracted through rex it would be like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=_raw "(?&amp;lt;EMPID&amp;gt;[0-9]{12})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You have to check the regexp.&lt;/P&gt;

&lt;P&gt;Finally, your request may be look like this (for netezza)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; splunk_server=ass index="ass_main" host=*pr
 | rex field=_raw "(?&amp;lt;EMPID&amp;gt;[0-9]{12})"
 | dedup EMPID
 | fields EMPID
 | stats values(EMPID) as EMPID
 | eval EMPID = "'".mvjoin(EMPID, "','")."'"
 | map search="| dbxquery query=\"select \\\"Employer Name\\\" PR, \\\"Employee Number\\\" EMPID FROM BIA_BA_EUL.\\\"View Employee Helpdesk\\\" WHERE \\\"Employee Number\\\" in ($EMPID$)\" connection=\"EMP-PR\"" 
 | fields EMPID,PR
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;edit :&lt;BR /&gt;
For some databases &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;splunk_server=ass index="ass_main" host=*pr
 | rex field=_raw "(?&amp;lt;EMPID&amp;gt;[0-9]{12})"
 | dedup EMPID
 | fields EMPID
 | stats values(EMPID) as EMPID
 | eval EMPID = "'".mvjoin(EMPID, "','")."'"
 | map search="| dbxquery query=\"select `Employer Name` PR, `Employee Number` EMPID FROM BIA_BA_EUL.`View Employee Helpdesk` WHERE `Employee Number` in ($EMPID$)\" connection=\"EMP-PR\"" 
 | fields EMPID,PR
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Aug 2019 09:58:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460296#M129842</guid>
      <dc:creator>thomasroulet</dc:creator>
      <dc:date>2019-08-26T09:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460297#M129843</link>
      <description>&lt;P&gt;@thomasroulet &lt;/P&gt;

&lt;P&gt;Thanks a lot for answering, the above query looks perfect but for some reason, i am not getting the output for PR. EMPID is getting displayed as a field which has 9 values to it. Unfortunately, for security reasons i cant publish the results.&lt;BR /&gt;
Somehow, PR is not present as a field. &lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 01:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460297#M129843</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2019-08-27T01:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460298#M129844</link>
      <description>&lt;P&gt;Are you extraction PR as a field automatically? it's not in the SPL above. if you just do a search for:&lt;BR /&gt;
&lt;CODE&gt;splunk_server=ass index="ass_main" host=*pr&lt;/CODE&gt;&lt;BR /&gt;
does PR show as a field? If not, you may need to extract it, just like you did with EMPID. Also, the EMPID looks to take from the beginning as there is no pattern to match before (or after), so it may be grabbing too much. Is there data, or some text around the EMPID in the records? something to tell rex where to start and end? &lt;BR /&gt;
Please take a look here for some sample rex commands: &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Rex"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 04:30:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460298#M129844</guid>
      <dc:creator>nyc_jason</dc:creator>
      <dc:date>2019-08-27T04:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460299#M129845</link>
      <description>&lt;P&gt;@jschogel &lt;/P&gt;

&lt;P&gt;I am using  pattern EMP[0-9]{12} as part of rex and associating it to EMPID. There are no issues here and i am getting the desired valuesof EMPID.&lt;BR /&gt;
For all the unique EMPID received from first search, i am trying to fetch the Employer name (alias:PR) from the database dbxquery search and then basically print  fields EMPID,PR&lt;BR /&gt;
PR is not a field as part of first search, the intention is to fetch it from the database for each value of EMPID.&lt;BR /&gt;
The problem here is i am not getting PR as a field after the query is run but getting only the EMPID.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 05:12:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460299#M129845</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2019-08-27T05:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460300#M129846</link>
      <description>&lt;P&gt;ah, gotch. just realized that. is EMPID an int in the DB? have you tried the IN clause without single quotes around the values, just the commas to separate?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 05:32:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460300#M129846</guid>
      <dc:creator>nyc_jason</dc:creator>
      <dc:date>2019-08-27T05:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460301#M129847</link>
      <description>&lt;P&gt;@Anonymous &lt;/P&gt;

&lt;P&gt;I do not think there is any issue with single quotes.&lt;/P&gt;

&lt;P&gt;I did try to print EMPID with the below query and it is coming fine as expected.&lt;BR /&gt;
 splunk_server=ass index="ass_main" host=*pr&lt;BR /&gt;
  | rex field=_raw "(?[0-9]{12})"&lt;BR /&gt;
  | dedup EMPID&lt;BR /&gt;
  | fields EMPID&lt;BR /&gt;
  | stats values(EMPID) as EMPID&lt;BR /&gt;
  | eval EMPID = "'".mvjoin(EMPID, "','")."'"&lt;BR /&gt;
  | table EMPID&lt;/P&gt;

&lt;P&gt;Tried the below query separate, which is giving result as expected:&lt;BR /&gt;
| dbxquery query=\"select \"Employer Name\" PR, \"Employee Number\" EMPID FROM BIA_BA_EUL.\"View Employee Helpdesk\" WHERE \"Employee Number\" in ($EMPID$)\" connection=\"EMP-PR\"&lt;/P&gt;

&lt;P&gt;The issue is in the combined query where field PR is not getting displayed, but EMPID is present as a field&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460301#M129847</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2020-09-30T01:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460302#M129848</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
What versions of Spunk, Splunk DB Connect, and Database Drivers are you using?&lt;BR /&gt;
What database are you trying to query?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 06:36:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460302#M129848</guid>
      <dc:creator>thomasroulet</dc:creator>
      <dc:date>2019-08-27T06:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460303#M129849</link>
      <description>&lt;P&gt;@thomasroulet &lt;BR /&gt;
Excuse me for the delayed response. Please find below the details:&lt;/P&gt;

&lt;P&gt;Splunk Version:7.2.6&lt;/P&gt;

&lt;P&gt;Splunk DB Connect Details:&lt;BR /&gt;
App Version&lt;BR /&gt;
3.1.3&lt;BR /&gt;
App Build&lt;BR /&gt;
55&lt;/P&gt;

&lt;P&gt;Database being connected:&lt;BR /&gt;
Netezza&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 12:25:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460303#M129849</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2019-08-29T12:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460304#M129850</link>
      <description>&lt;P&gt;I made some tests with : &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Splunk 7.2.6,&lt;/LI&gt;
&lt;LI&gt;DBConnect 3.1.3, &lt;/LI&gt;
&lt;LI&gt;mysql-connector-java-5.1.48 driver, &lt;/LI&gt;
&lt;LI&gt;Mysql 5.1,&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;the following dataset in mysql in a table t_champs: &lt;/P&gt;

&lt;P&gt;id,id_suiviflux,nom_champs,valeur_champs&lt;BR /&gt;
"1","1","champ1","valeur 1"&lt;BR /&gt;
"2","1","champ2","valeur - 2"&lt;BR /&gt;
"3","1","champ3","valeur'3"&lt;BR /&gt;
"4","2","champ1","valeur ""21"&lt;BR /&gt;
"5","2","champ2","valeur22"""&lt;BR /&gt;
"6","2","champ3","valeur23"&lt;BR /&gt;
"7","1","champ6","valeur6"&lt;BR /&gt;
"8","2","champ4","valeur24"&lt;BR /&gt;
"9","1","champ4","valeur4"&lt;BR /&gt;
"10","1","champ5","valeur5"&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;the following command : &lt;/P&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
| eval _raw="id&lt;BR /&gt;
1&lt;BR /&gt;
10&lt;BR /&gt;
" &lt;BR /&gt;
| multikv forceheader=1&lt;BR /&gt;
| stats values(id) as id&lt;BR /&gt;
| eval id = mvjoin(id, ",")&lt;BR /&gt;
| map search="| dbxquery query=\"select * from t_champs where id in ($id$)\"  connection=\"EMP-PR\""&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The results are correct :&lt;BR /&gt;
id  id_suiviflux    nom_champs  valeur_champs&lt;BR /&gt;
1   1   champ1  valeur 1&lt;BR /&gt;
10  1   champ5  valeur5&lt;/P&gt;

&lt;P&gt;So it seems that is not a splunk or db connect issue, maybe the connector or/and the SQL Interpretor in natezza.&lt;BR /&gt;
Could you try to create the same dataset in Netezza, apply the command and post your results ? &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:00:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460304#M129850</guid>
      <dc:creator>thomasroulet</dc:creator>
      <dc:date>2020-09-30T02:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460305#M129851</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/171022"&gt;@thomasroulet&lt;/a&gt; &lt;BR /&gt;
While my team is analysing, i tried append as well which is throwing a netezza error. There is still some problem while passing the input variable to the query.&lt;/P&gt;

&lt;P&gt;| rex field=_raw "(?[0-9]{12})"&lt;BR /&gt;
| dedup EMPID&lt;BR /&gt;
| fields EMPID&lt;BR /&gt;
| stats values(EMPID) as EMPID&lt;BR /&gt;
| eval EMPID = "'".mvjoin(EMPID, "','")."'"&lt;BR /&gt;
| append [| dbxquery connection="EMP-PR" &lt;BR /&gt;
query="select \"Employee Name\" PR&lt;BR /&gt;
FROM&lt;BR /&gt;
BIA_BA_EUL.\"View Employee Helpdesk\" WHERE \"Employee Number\" IN ($EMPID$)"]&lt;BR /&gt;
| table PR&lt;/P&gt;

&lt;P&gt;Error:&lt;BR /&gt;
[subsearch]: org.netezza.error.NzSQLException: ERROR: 'select "Employee Name" PR FROM BIA_BA_EUL."View Employee Helpdesk" WHERE "Emplyee Number" IN ($EMPID$) ANALYZE' error ^ found "$" (at char 124) expecting an identifier found a keyword&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:02:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460305#M129851</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2020-09-30T02:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460306#M129852</link>
      <description>&lt;P&gt;I just realized you are not passing EMPID as a variable/token, you are passing a created field. The |eval EMPID=.... is creating a field called EMPID, not a token. Try using EMPID as a field name in the creation of the query, and just concatenate it in:&lt;BR /&gt;
...&lt;BR /&gt;
| append [| dbxquery connection="EMP-PR" &lt;BR /&gt;
query="select \"Employee Name\" PR&lt;BR /&gt;
FROM&lt;BR /&gt;
BIA_BA_EUL.\"View Employee Helpdesk\" WHERE \"Employee Number\" IN (".EMPID.")"]&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:02:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460306#M129852</guid>
      <dc:creator>nyc_jason</dc:creator>
      <dc:date>2020-09-30T02:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460307#M129853</link>
      <description>&lt;P&gt;@Anonymous &lt;/P&gt;

&lt;P&gt;I did not fully understand your above comment. However i tried the below query and it is still not displaying me the Employer name.&lt;/P&gt;

&lt;P&gt;| rex field=_raw "(?[0-9]{12})"&lt;BR /&gt;
| dedup EMPID&lt;BR /&gt;
| fields EMPID&lt;BR /&gt;
| stats values(EMPID) as EMPID&lt;BR /&gt;
| eval EMPID = "'".mvjoin(EMPID, "','")."'"&lt;BR /&gt;
| append [| dbxquery connection="EMP-PR" &lt;BR /&gt;
query="select \"Employee Name\" PR&lt;BR /&gt;
FROM&lt;BR /&gt;
BIA_BA_EUL.\"View Employee Helpdesk\" WHERE \"Employee Number\" IN (".EMPID.")"]&lt;BR /&gt;
| table PR&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:02:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460307#M129853</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2020-09-30T02:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460308#M129854</link>
      <description>&lt;P&gt;from the looks of the error returned from netezza $EMPID$ is being passed in as a literal string, and not the list of employee ids. So netezza is getting: &lt;/P&gt;

&lt;P&gt;'select "Employee Name" PR FROM BIA_BA_EUL."View Employee Helpdesk" WHERE "Employee Number" IN $EMPID$&lt;/P&gt;

&lt;P&gt;as opposed to something like:&lt;/P&gt;

&lt;P&gt;'select "Employee Name" PR FROM BIA_BA_EUL."View Employee Helpdesk" WHERE "Employee Number" IN ('123','456','789')&lt;/P&gt;

&lt;P&gt;You need to check the list of EMPIDs is proper, and the full query is being created with it.&lt;/P&gt;

&lt;P&gt;To see the empid list and query being generated, you could do something similar to this:&lt;/P&gt;

&lt;P&gt;| rex field=_raw "(?[0-9]{12})"&lt;BR /&gt;
| dedup EMPID&lt;BR /&gt;
| fields EMPID&lt;BR /&gt;
| stats values(EMPID) as EMPID&lt;BR /&gt;
| eval EMPID = "'".mvjoin(EMPID, "','")."'"&lt;BR /&gt;
| append [| eval query_text="select \"Employee Name\" PR&lt;BR /&gt;
FROM&lt;BR /&gt;
BIA_BA_EUL.\"View Employee Helpdesk\" WHERE \"Employee Number\" IN (".EMPID.")"]&lt;BR /&gt;
| table EMPID, query_text&lt;/P&gt;

&lt;P&gt;This should You should show you the SQL statement that is being generated, and will be easier to see whats wrong, such as syntax&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:02:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460308#M129854</guid>
      <dc:creator>nyc_jason</dc:creator>
      <dc:date>2020-09-30T02:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460309#M129855</link>
      <description>&lt;P&gt;@jschogel &lt;/P&gt;

&lt;P&gt;Thanks for the response.&lt;BR /&gt;
I tried the above query.&lt;/P&gt;

&lt;P&gt;Values for EMPID was 'EMP1','EMP2','EMP3'&lt;BR /&gt;
but however query_text is null&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 04:45:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460309#M129855</guid>
      <dc:creator>manunairadavakk</dc:creator>
      <dc:date>2019-09-02T04:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass input variable to dbxquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460310#M129856</link>
      <description>&lt;P&gt;The "append" command will not replace $EMPID$ with the values of $EMPID$&lt;/P&gt;

&lt;P&gt;With the "append" command, "...".EMPID."..." will replace EMPID with the values but will be interpreted by one value in a string : "EMPID1, EMPID2, EMPID3" and not 3 values.&lt;/P&gt;

&lt;P&gt;The map command will do this replacement and will be interpreted as 3 values.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 08:44:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-input-variable-to-dbxquery/m-p/460310#M129856</guid>
      <dc:creator>thomasroulet</dc:creator>
      <dc:date>2019-09-02T08:44:49Z</dc:date>
    </item>
  </channel>
</rss>

