+ 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');

16th Dec 2018, 6:04 PM
Arne Van Kerckvoorde
Arne Van Kerckvoorde - avatar
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');
16th Dec 2018, 8:02 PM
sneeze
sneeze - avatar