# IBM Db2 - Select rows using custom SQL action
This action lets you select rows that match a custom SQL query.
Learn about some Improving the performance of SQL procedures (opens new window).
50,000 RECORD LIMIT
Starting February 8, 2026, the Select rows using custom SQL action returns a maximum of 50,000 records for all new recipes and existing recipes that don't currently exceed this limit. Starting March 15, 2026, this limit extends to all recipes using this action, including existing recipes that currently exceed the limit.
Recipes configured to retrieve more than 50,000 records will be truncated to this limit.
This change improves platform reliability and performance while preventing large queries from overloading database connections or impacting upstream systems.
# Input
- SQL
- Required field
- The custom SQL statement that runs on selected rows. This generates the output datatree.
Wrap datapills in single quote characters,'.
Do not add a;at the end of your SQL query; this causes the step to fail.
Do not add a LIMIT clause to restrict query size. Use the Limit input field instead.
- Parameters
- Optional field
- Assign values to your bind variables
- Order by
- Optional field
- Order of rows to return, such as
updated_at DESC.
- Limit
- Optional field
- The maximum number of rows to return. The default is 100, and the maximum is 50,000 rows.
- Offset
- Optional field
- The option to fetch only a page of results from the entire results set.
For example, to skip the first 100 rows of the selected results set, input 100 to this field.
The default is 0.
- Output fields
- Optional field
- Define the expected fields of each retrieved Document. Enables users to generate datapills for use in downstream systems, or to drive Recipe logic.
- Output CSV?
- Optional field
- Select Yes to output a CSV string of the selected data.
# Output
- rows
- Array of JSON objects, where each object represents a retrieved row.
- rows_count
- Number of retrieved rows.
Last updated: 2/5/2026, 8:02:30 PM