Row Count With OUTPUT EVERY

Use the OUTPUT EVERY clause with a row count. Provides an example of how to apply the OUTPUT EVERY clause to a row count, as well as, the syntax rules for the clause.

INSERT INTO StockVolumeOut 
SELECT SUM(volume) 
FROM StockTrades KEEP EVERY 1 DAY 
OUTPUT EVERY 5 ROWS;

Here is an example of how this query generates output rows every 5 rows, regardless of when data arrives:



Notice that the output row timestamp is the value from the 5th and 10th input rows respectively.

The OUTPUT ALL EVERY syntax is permitted for row count intervals, but it has no impact on the query, since there is no way rows can be missing from a row count interval (by definition, the interval is defined based on the very fact that rows have been published).

Grouped queries are also permitted with OUTPUT EVERY row count syntax. As with timed intervals, the output is broken into groups. However, unlike timed intervals, where all groups are published at each interval, each individual group is published based on the number of rows specified in the row count for that group.


Created March 8, 2010. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com