Skip to main content

Using Store Procedures

Sometimes you need some data that requires executing complex queries; for that, you may want to use stored procedures in the SQL Database

1. GraphQL Query Signature

2. Parameters

  • name (required): Name of the stored procedure
  • params (optional): JSON object with stored procedure parameters
  • limit (optional): Result limit (can be passed directly or inside params).
  • offset (optional): Offset for pagination (can be passed directly or inside params)
If you are using this data source in the Datagrid component, it will send the limitandlimit and offset automatically. You only need to implement the pagination on the store procedure side.
The order of parameters in params matters, as they are passed positionally.

Usage Examples:

Example 1: With parameters and separate pagination
Generates: EXEC GetUsers 'active', 'admin', 10, 0 Example 2: With pagination inside params
Generates: EXEC GetUsers 'active', 10, 0 Example 3: Only with limit and offset as separate parameters
Generates: EXEC GetAllUsers 20, 10 Example 4: Send params as a variable
Datasource Variables: we need to put the variables (parameters, limit, and offset) that we will send to the SP example variable list:
Complete example:

1. Stored Procedure in SQL Server

GraphQL Call

2. More Complete Example with Multiple Parameters

Graphql Call