Last active
August 7, 2017 14:09
-
-
Save igoralves1/de93643c078c71c574f2f45fd45a1bf0 to your computer and use it in GitHub Desktop.
SQL => DEFAULT CURRENT_TIMESTAMP => Insert timestamp by default in a Table
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 characters
| /* | |
| Just use the CURRENT_TIMESTAMP as DEFAULT | |
| when creating the table. | |
| In the query we will not need to insert | |
| any date. | |
| That will be automatically inserted by | |
| mysql engine | |
| */ | |
| CREATE TABLE `db_Logs` ( | |
| `id` BIGINT(20) NOT NULL AUTO_INCREMENT, | |
| `dt_llog` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, | |
| `msg` MEDIUMTEXT NULL, | |
| `sql` MEDIUMTEXT NULL, | |
| `StackTrace` MEDIUMTEXT NULL, | |
| `exceptionObjc` MEDIUMTEXT NULL, | |
| PRIMARY KEY (`id`) | |
| ) | |
| COLLATE='latin1_swedish_ci' | |
| ENGINE=InnoDB | |
| AUTO_INCREMENT=32290 | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment