Splunk® DB Connect

Deploy and Use Splunk DB Connect

Create and use Stored Procedures in MS SQL

Create and use stored procedures in MS SQL within inputs that use rising mode.

Requirements

  1. Make sure you use Microsoft JDBC Driver instead of jTDS. Select connection types with MS-SQL Server Using MS Generic Driver as prefix.
  2. Avoid selecting the database using USE [<database>], as DB Connect won't be able to fetch the query metadata.

Create the Stored Procedure

When creating the stored procedure, you must make sure to receive the desired rising column as a parameter.

Example:

Given the sp_get_delivery as Stored Procedure under customer database and order schema:

CREATE PROCEDURE order.sp_get_delivery
(
    @order_id numeric
)
AS
BEGIN
  SELECT * FROM order.delivery where order_id > @order_id ORDER BY order_id ASC;
END

Use the Stored Procedure

When creating the input in Splunk DB Connect use the EXEC command to execute the stored procedure.

Example:

Using the previously defined stored procedure.

EXEC [customer].[order].[sp_get_delivery] @order_id = ?
Last modified on 30 January, 2025
Execute SQL statements and stored procedures with the dbxquery command   Monitor Splunk DB Connect health

This documentation applies to the following versions of Splunk® DB Connect: 4.0.0


Please expect delayed responses to documentation feedback while the team migrates content to a new system. We value your input and thank you for your patience as we work to provide you with an improved content experience!

Was this topic useful?







You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters