Posted By

kidmizere on 12/17/13


Tagged

dates Fill


Versions (?)

fill dates MYSQL


 / Published in: MySQL
 

URL: http://stackoverflow.com/questions/10132024/how-to-populate-a-table-with-a-range-of-dates

Not Mine but nicely done

  1. CREATE PROCEDURE filldates (dateStart DATE, dateEnd DATE)
  2. BEGIN
  3.  
  4. WHILE dateStart <= dateEnd DO
  5. INSERT INTO workflow (workdate)
  6. VALUES
  7. (dateStart);
  8.  
  9.  
  10. SET dateStart = DATE_ADD(dateStart, INTERVAL 1 DAY);
  11.  
  12.  
  13. END
  14. WHILE;
  15.  
  16.  
  17. END;

Report this snippet  

You need to login to post a comment.