ASA SQL Reference
System Tables
Column name | Column type | Column constraint | Table constraints |
---|---|---|---|
row_num | SMALLINT | NOT NULL |
The dbo.RowGenerator table is provided as a read-only table that has 255 rows. This table can be useful for queries which produce small result sets and which need a range of numeric values.
The RowGenerator table is used by system stored procedures and views, and should not be modified in any way.
row_num A value between 1 and 255.
The following query returns a result set containing one row for each day of the current month.
select dateadd(day,row_num-1, ymd(datepart(year,current date), datepart(month,current date), 1)) as day_of_month from dbo.RowGenerator where row_num < 32 and datepart(month,day_of_month) = datepart(month,current date) order by row_num