Created
April 4, 2016 10:24
-
-
Save nguyenkims/229422b8896d43aaa74bf8b9ed5a97c0 to your computer and use it in GitHub Desktop.
Revisions
-
nguyenkims created this gist
Apr 4, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ DROP PROCEDURE IF EXISTS fillupdate; DELIMITER // CREATE PROCEDURE fillupdate() BEGIN DECLARE nbdate INT DEFAULT 0; DECLARE dt DATETIME DEFAULT 0; SET dt = '2016-01-01'; while nbdate < 365 do set nbdate = nbdate + 1; set dt = date_add(dt, interval 1 day); INSERT INTO dates(dt) values(dt); end while; END; // DELIMITER ; call fillupdate();