<?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: what can be used in SPL for decalre variables in SQL . in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343822#M101853</link>
    <description>&lt;P&gt;@DalJeanis, instead of using _time can i use now(), because _time changes for every event right ? &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2017 13:17:36 GMT</pubDate>
    <dc:creator>raghu0463</dc:creator>
    <dc:date>2017-08-03T13:17:36Z</dc:date>
    <item>
      <title>what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343811#M101842</link>
      <description>&lt;P&gt;im trying to write spl for one of the sql quires which has like declare variables and CTE tables im bit confused what to use in SPL for that. &lt;/P&gt;

&lt;P&gt;example : &lt;/P&gt;

&lt;P&gt;SQL - declare @prev date &lt;BR /&gt;
SPL ?&lt;/P&gt;

&lt;P&gt;SQL - declare @table1 table(col1 date)&lt;BR /&gt;
SPL - ?&lt;/P&gt;

&lt;P&gt;SQL - &lt;BR /&gt;
with cte as&lt;BR /&gt;
(select col1 from table1 &lt;BR /&gt;
union all &lt;BR /&gt;
select dateadd(day,1,col1) from cte &lt;BR /&gt;
where col1 &amp;lt; maxdate-1)&lt;/P&gt;

&lt;P&gt;how to convert this SQL into SPL pls ?&lt;/P&gt;

&lt;P&gt;thanks &lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 18:33:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343811#M101842</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-07-31T18:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343812#M101843</link>
      <description>&lt;P&gt;It will be easier for us if you show us the event data and what you would like the final form to be.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 18:51:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343812#M101843</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-31T18:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343813#M101844</link>
      <description>&lt;P&gt;can i get ur email pls, so that i can send it you ..&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:03:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343813#M101844</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-07-31T19:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343814#M101845</link>
      <description>&lt;P&gt;You don't need to declare variables in Splunk. Just use them. &lt;CODE&gt;| eval myVar = 12345&lt;/CODE&gt; makes a new 'variable' (called a field in Splunk) that has a numeric value.&lt;BR /&gt;
&lt;CODE&gt;| eval myVar2 = "This is a string"&lt;/CODE&gt; makes a string. Easy. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:16:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343814#M101845</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2017-07-31T19:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343815#M101846</link>
      <description>&lt;P&gt;A recursive CTE, such as the one you posted, is a fantastic feature of a couple of variants of SQL, and are designed to solve specific problems.  The basic answer is, you can't translate a recursive CTE directly.  I want to make absolutely clear, the &lt;STRONG&gt;general&lt;/STRONG&gt; answer to your &lt;STRONG&gt;general&lt;/STRONG&gt; question is, &lt;STRONG&gt;"You CAN'T."&lt;/STRONG&gt;  You have to figure out what it is doing, and then analyze how to accomplish it in a different, splunky, way.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;However, the GREAT news is that this particular CTE is merely accomplishing a task that in splunk is trivial.  Specifically, "How do I create a list of dates from the value in &lt;CODE&gt;col1&lt;/CODE&gt; to one day less less than the value in &lt;CODE&gt;maxdate&lt;/CODE&gt;?"&lt;/P&gt;

&lt;P&gt;Here's the SPL code for that, assuming that &lt;CODE&gt;Date1Epoch&lt;/CODE&gt; and &lt;CODE&gt;Date2Epoch&lt;/CODE&gt; are both already in epoch format...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval mysetofdates=mvrange(Date1Epoch, Date2Epoch, 86400)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That creates a single field called &lt;CODE&gt;mysetofdates&lt;/CODE&gt; that has the entire list, starting from &lt;CODE&gt;Date1Epoch&lt;/CODE&gt;, and ending BEFORE &lt;CODE&gt;Date2Epoch&lt;/CODE&gt;.  &lt;/P&gt;

&lt;P&gt;Now, how you use that multivalue field to meet the rest of your needs is  going to depend on the rest of your requirements. You will probably end up using &lt;CODE&gt;mvexpand&lt;/CODE&gt;, but after that it's anybody's guess.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:19:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343815#M101846</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-31T19:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343816#M101847</link>
      <description>&lt;P&gt;then how about the variable table pls ?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 14:27:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343816#M101847</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-08-01T14:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343817#M101848</link>
      <description>&lt;P&gt;It is in my profile.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 14:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343817#M101848</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-01T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343818#M101849</link>
      <description>&lt;P&gt;here in the eval mysetofdates  will hold all the dates right ?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 19:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343818#M101849</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-08-02T19:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343819#M101850</link>
      <description>&lt;P&gt;@raghu0463  - Right, it will be a multivalue field with epoch values of the dates, such as the results of this code... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | bin _time span=1d |eval mytime=mvrange(_time-86400*3,_time,86400)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...which looks like...   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1501372800
1501459200
1501545600
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Aug 2017 20:38:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343819#M101850</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-02T20:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343820#M101851</link>
      <description>&lt;P&gt;Hello DalJeanis,&lt;/P&gt;

&lt;P&gt;I have one more question, im trying to ingest data from sql server tables (3) and also date from one view  into splunk, &lt;BR /&gt;
lets say A,B,C are table names &lt;BR /&gt;
 Z is view name &lt;BR /&gt;
for table c the no.of records in the table are 76500, it has composite primary key. will i able to store all the records in one stretch. if not, what should i use in the rising column.   &lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 03:32:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343820#M101851</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-08-03T03:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343821#M101852</link>
      <description>&lt;P&gt;hello Daljeanis, &lt;/P&gt;

&lt;P&gt;i tried to build spl for the first question, but im getting errors, im bit new to splunk. will you able to provide me your email id pls so that i can  send my question to you. &lt;/P&gt;

&lt;P&gt;thanks &lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 03:36:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343821#M101852</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-08-03T03:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343822#M101853</link>
      <description>&lt;P&gt;@DalJeanis, instead of using _time can i use now(), because _time changes for every event right ? &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 13:17:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343822#M101853</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-08-03T13:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343823#M101854</link>
      <description>&lt;P&gt;@raghu0463 - let's keep the questions and answers on the forum, where other people can benefit from them, and where I can ask friends for help if they go a direction that isn't my area.  Feel free to link up with me on LinkedIn (&lt;A href="https://www.linkedin.com/in/daljeanis"&gt;https://www.linkedin.com/in/daljeanis&lt;/A&gt;) and ask me there if it's anything confidential, but at this level of questions, it's better to post it here.   &lt;/P&gt;

&lt;P&gt;Without seeing the rest of the SQL, I don't know &lt;STRONG&gt;why&lt;/STRONG&gt; the CTE code is generating that list of dates.  &lt;CODE&gt;now()&lt;/CODE&gt; would be fine, assuming that the intention is to generate a list of dates from today to just less than some fixed future date.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;With regard to your "rising column" question, please post that as a new question so it can get proper attention.  Give it a title like "What would I use for rising column in this scenario...?".&lt;/P&gt;

&lt;P&gt;Give us non-confidential details about the keys of the three tables, and what significant fields (dates, update date/time etc) are available in those columns.  You can post the SQL, clipped back to basics as much as you can without affecting the actual joins, binds  and tricky bits.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 13:44:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343823#M101854</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-03T13:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: what can be used in SPL for decalre variables in SQL .</title>
      <link>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343824#M101855</link>
      <description>&lt;P&gt;@DalJeanis &lt;/P&gt;

&lt;P&gt;when i was using &lt;BR /&gt;
|eval mytime=mvrange(now()-86400*90,now(),86400)| eval date = strftime(mytime,"%y/%m/%d") | stats count(date) &lt;/P&gt;

&lt;P&gt;im getting the count 59490 , but i think i should get 90. what is the error in the above commands pls  &lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 15:43:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/what-can-be-used-in-SPL-for-decalre-variables-in-SQL/m-p/343824#M101855</guid>
      <dc:creator>raghu0463</dc:creator>
      <dc:date>2017-08-03T15:43:55Z</dc:date>
    </item>
  </channel>
</rss>

