<?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: CHAR INDEX query same as MS SQL in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241880#M21600</link>
    <description>&lt;P&gt;There could have been more in your search that I didn't see because you didn't use the code button to format it.  The only &lt;EM&gt;important&lt;/EM&gt; part I did was replace your &lt;CODE&gt;eval exception=...&lt;/CODE&gt; with the &lt;CODE&gt;rex field=_raw ( ...&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Or, do you want a SQL query to do this?  I read your question as "Please help me make a Splunk search that does what in a SQL Query I'd describe as ..."&lt;/P&gt;

&lt;P&gt;As shown my this run-anywhere example, the rex works.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=11/21/2016 end=11/22/2016
| eval test="Failed: 142352C Code: PH Power Hotel:: This is test that should be stripped" 
| rex field=test "^(?&amp;lt;exception&amp;gt;.*)::" 
| table test, exception
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Gives results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;test            exception   
Failed: 142352C Code: PH Power Hotel:: This is test that should be stripped     Failed: 142352C Code: PH Power Hotel 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need a SQL query, well, this isn't the right forums for that.  But I can give you the hint that you'll wan to use your SQL language's variety of "search" or "find" to search for particular text "::" inside the field, and use that return position in your substring command.  You can find examples using your favorite search engine.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2016 12:54:05 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2016-11-21T12:54:05Z</dc:date>
    <item>
      <title>CHAR INDEX query same as MS SQL</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241877#M21597</link>
      <description>&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/174246-capture.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;index="prod_client_sync_dbconnect" sessionid!=sessionid |   eval exception=substr(exception,1,150) | stats count as "Number of errors" by exception | rename exception as Exception | sort -  "Number of errors"&lt;/P&gt;

&lt;P&gt;We need to show the error till double colon (::) after double colon (::) whatever the error should truncate and display only before double colon (::).&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241877#M21597</guid>
      <dc:creator>puneethgowda</dc:creator>
      <dc:date>2020-09-29T11:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR INDEX query same as MS SQL</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241878#M21598</link>
      <description>&lt;P&gt;&lt;STRONG&gt;EDIT&lt;/STRONG&gt;: copy paste error again.  I should just stop this morning until I finish this cup of coffee...  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I'm assuming you want to replace your eval of exception below to make one that reads up to double colons?  Use the following, then.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod_client_sync_dbconnect" sessionid!=sessionid | rex field=_raw "^(?&amp;lt;exception&amp;gt;.*)::"  | stats count as "Number of errors" by exception | rename exception as Exception | sort - "Number of errors"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let us know how it goes!&lt;/P&gt;

&lt;P&gt;Happy Splunking!&lt;BR /&gt;
Rich&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2016 12:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241878#M21598</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-11-18T12:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR INDEX query same as MS SQL</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241879#M21599</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2176iEC6D27E92FC9354A/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hi Rich,&lt;/P&gt;

&lt;P&gt;Thanks a lot but nothing is happening with your query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Cannot insert the value NULL into column 'city_cd', table 'HotelHubServices.dbo.pb_custmastclntsync_mc'; column does not allow nulls. INSERT fails. The statement has been terminated. :: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean&amp;amp; dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task&amp;amp; task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task&amp;amp; task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at TCT.DbConnect.Getrs(String SpName, SqlParameter[] SpParameters, Int32 TimeOut, Boolean ConnectLogDatabase) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Nov 2016 09:56:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241879#M21599</guid>
      <dc:creator>puneethgowda</dc:creator>
      <dc:date>2016-11-21T09:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR INDEX query same as MS SQL</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241880#M21600</link>
      <description>&lt;P&gt;There could have been more in your search that I didn't see because you didn't use the code button to format it.  The only &lt;EM&gt;important&lt;/EM&gt; part I did was replace your &lt;CODE&gt;eval exception=...&lt;/CODE&gt; with the &lt;CODE&gt;rex field=_raw ( ...&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Or, do you want a SQL query to do this?  I read your question as "Please help me make a Splunk search that does what in a SQL Query I'd describe as ..."&lt;/P&gt;

&lt;P&gt;As shown my this run-anywhere example, the rex works.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=11/21/2016 end=11/22/2016
| eval test="Failed: 142352C Code: PH Power Hotel:: This is test that should be stripped" 
| rex field=test "^(?&amp;lt;exception&amp;gt;.*)::" 
| table test, exception
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Gives results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;test            exception   
Failed: 142352C Code: PH Power Hotel:: This is test that should be stripped     Failed: 142352C Code: PH Power Hotel 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need a SQL query, well, this isn't the right forums for that.  But I can give you the hint that you'll wan to use your SQL language's variety of "search" or "find" to search for particular text "::" inside the field, and use that return position in your substring command.  You can find examples using your favorite search engine.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 12:54:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/CHAR-INDEX-query-same-as-MS-SQL/m-p/241880#M21600</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-11-21T12:54:05Z</dc:date>
    </item>
  </channel>
</rss>

