+ 10
SELECT CURRENT_TIMESTAMP error
I'm trying to use SELECT CURRENT_TIMESTAMP in sql but the database sets it to 0000-00-00 00:00:00; Original code: INSERT INTO articles (title, text, link, date, author) VALUES ('title', 'text', 'link',' (SELECT CURRENT_TIMESTAMP) ','user');
1 Answer
+ 2
use it as constant not as a query.
So without quotation and without SELECT.
https://docs.microsoft.com/en-us/sql/t-sql/functions/current-timestamp-transact-sql?view=sql-server-2017
http://www.microhowto.info/howto/insert_the_current_date_and_time_into_an_sql_database.html
INSERT INTO events (ts,description) VALUES (CURRENT_TIMESTAMP,'disc full');