Splunk Search

DB Connect - another "index 1 is out of range" - how to fix it?

arimaldo
Explorer

Trying to pull specific fields out of the database tables "LastContact" and listing the output with a timestamp (LastContact), ManagerName (hostname), OSType etc. This is the query I'm using:

SELECT [Hostname], [ManagerName],[OSType],[LastContact]FROM [SCSPDB].[dbo].[ASSET_VW] WHERE LastContact < dateadd(day,-1,getdate());

Works fine in SQL Explorer but not in DBX (errors out with the "index 1 out of range" message). Do I need to change my query from using a Rising Column (LastContact) to something else?

Tags (1)
0 Karma
1 Solution

arimaldo
Explorer

I answered my own question.....DBX is very finicky about its queries. This particular query is too static and DBX requires a "?" in order for the Rising Column to assign a value. This works:

SELECT [Hostname], [ManagerName],[OSType],[LastContact]FROM [SCSPDB].[dbo].[ASSET_VW] WHERE LastContact > ? ORDER BY LastContact ASC

View solution in original post

0 Karma

arimaldo
Explorer

I answered my own question.....DBX is very finicky about its queries. This particular query is too static and DBX requires a "?" in order for the Rising Column to assign a value. This works:

SELECT [Hostname], [ManagerName],[OSType],[LastContact]FROM [SCSPDB].[dbo].[ASSET_VW] WHERE LastContact > ? ORDER BY LastContact ASC

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...