1

I use this function INSERT (http://www.smallsql.de/doc/sql-functions/string/insert.html) to add a value in a data:

INSERT (log, POSITION(' edited' IN log), 1, 'NOW()')

I use also the NOW function to add the date in the data but it does not work. What is the problem?

6
  • Why cant you use mysql or postgresql? Its the first time av heard of smallsql!
    – indago
    Feb 21, 2014 at 9:06
  • it's used in an update request with my sql. I think the error is in the now () function after test but how can i correct it
    – Amirov
    Feb 21, 2014 at 9:10
  • is there a date() function? whats the exact error message you are getting?
    – indago
    Feb 21, 2014 at 9:16
  • NOW() is a function (w3schools.com/sql/sql_func_now.asp). if i delete NOW() to my request the data is updated else i have a syntax error
    – Amirov
    Feb 21, 2014 at 9:22
  • @Amirov: now() is not a standard (ANSI) SQL function. You should not believe w3schools, that site is full of errors.
    – user1822
    Feb 21, 2014 at 11:20

1 Answer 1

1

When you write your INSERT query:

INSERT (log, POSITION(' edited' IN log), 1, 'NOW()')

In this way the DBMS thinks you try to put in your date field a string named "NOW()" instead of function to retrieve the current timestamp

You must remove the ' ' around NOW() function. In this way:

INSERT (log, POSITION(' edited' IN log), 1, NOW())

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.