0
CREATE TABLE comments (
    content VARCHAR(100),
    created_at TIMESTAMP DEFAULT NOW()  
);

The error message

'NOW' is not a recognized built-in function name.

4
  • Please add the full error message (including the error code) and the result of select version(); Commented Aug 16, 2022 at 15:03
  • Started executing query at Line 1 Msg 195, Level 15, State 10, Line 3 'NOW' is not a recognized built-in function name Commented Aug 16, 2022 at 15:21
  • 1
    Msg 195, Level 15, State 10 is a sql-server error message and is correctly telling you that now() does not exist. - I think sql-server equivalent is getdate() or you are pointing to the wrong server.. Commented Aug 16, 2022 at 15:26
  • 1
    The tsql TIMESTAMP datatype is likely not what you want. That is a deprecated datatype and is now just a synonym for ROWVERSION - which has no relationship to date or time. Commented Aug 16, 2022 at 19:11

1 Answer 1

0

NOW() is not ansi-standard sql.

Given this is a SQL Server error message, I'll say that SQL Server people tend to use getdate() instead. However, the actual standard is current_timestamp, which FWIW is supported on both SQL Server and whichever of MySql or Posgresql you were using before, albeit they both treat is as a function (you need parentheses) while SQL Server treats it as a keyword (no parentheses).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.