So when i select max(date) from table and save it as variable MAX. Next alert it, messagebox will show me "2015-01-10" - actual date.
Next I'm trying to put that variable {MAX} to database and it inserts '2014' because 2015-1-10 = 2004...
How to avoid this problem?
SQL problem with date variable
Re: SQL problem with date variable
I'd like to see you INSERT SQL expression.
It seems you use only {MAX} without single quotes like this:
insert into myTable (field1, ...) values ({max},...)
your expression will be transformed into expression:
insert into myTable (field1, ...) values (2015-1-10,...)
In this case SQL engine think that it is an arithmetical expression and calculates it
Try to use '{MAX}' (with quotes)
The SQL expression will be like this:
insert into myTable (field1, ...) values ('{max}',...)
It seems you use only {MAX} without single quotes like this:
insert into myTable (field1, ...) values ({max},...)
your expression will be transformed into expression:
insert into myTable (field1, ...) values (2015-1-10,...)
In this case SQL engine think that it is an arithmetical expression and calculates it
Try to use '{MAX}' (with quotes)
The SQL expression will be like this:
insert into myTable (field1, ...) values ('{max}',...)
Oleg Yershov
Re: SQL problem with date variable
that was it! thanks