Hi! I am working on a flight reservation system with SQL Server 2008 and need help on the following: A stored procedure or function is required to insert up to 365 rows (dates), resp. 366 in case of a leap year into the flight instance table. The base flight table holds the flight days (as weekday no.), e.g.: If flight no. 3520 flies on Mondays, Fridays and Sundays, then the frequency would be stored like: 157 (1=Monday, 2=Tuesday, 3=Wednesday etc). So, the SP or function must first check the base flight table and insert the rows(dates) into the flight instance table accordingly. Flight table Flight_no, Frequency 3520 157 Flight Instance table Flight_no Flight_Date 3520 4/1/2008 3520 5/1/2008 3520 7/1/2008 .... Any ideas or scripts would be greatly appreciated! Thanks!