Whatever message this page gives is out now! Go check it out!

QuerySlice

Last update:
May 18, 2026

Description

Returns part of a query object with only the rows you need.

Returns

The number of records from the query object starting from an offset index.

Category

Syntax

QuerySlice(Object query,offset,length)
Member function
queryObject.Slice(offset,length)

History

New in ColdFusion (2018 release) Update 5.

Parameters

Parameter
Required/Optional
Description
Query
Required
The query object that you want to slice.
Offset
Required
Specifies the position from where to slice the query object.
Length
Optional
The number of rows from the offset. If you do not specify the length, the function returns all the records until the end of the query object.

See also

Example

<cfscript>
 myquery=QueryExecute("SELECT * FROM APP.ART",[],{datasource="cfartgallery"})
 slice1=QuerySlice(myquery,2,3) // Returns rows 2,3, and 4
 slice2=QuerySlice(myquery,50) // Returns all rows including and after row 50
 writedump(slice1)
 writedump(slice2)
</cfscript>

Output

Slice1
Slice2

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page