[sql] Generate a range of dates using SQL