Bob Bedford wrote:
Insert into article values(now(), now(),....)
but what appens if the time changes between the 2 now calls ?
In MySQL, it shouldn't, because MySQL guarantees a single statement to be
atomic, even if no other transactional mechanism is being used.
If you decide to use user variables, you'd be on the safe side, anyway.
http://dev.mysql.com/doc/mysql/en/ex...variables.html,
http://dev.mysql.com/doc/mysql/en/variables.html
"MySQL supports user variables as of version 3.23.6. You can store a value
in a user variable and refer to it later, which allows you to pass values
from one statement to another. User variables are connection-specific. That
is, a variable defined by one client cannot be seen or used by other
clients. All variables for a client connection are automatically freed when
the client exits."
mysql> select version();
+------------+
| version() |
+------------+
| 4.0.18-Max |
+------------+
1 row in set (0.00 sec)
mysql> select @t := now();
+---------------------+
| @t := now() |
+---------------------+
| 2005-03-21 11:10:17 |
+---------------------+
1 row in set (0.00 sec)
mysql> select @t;
+---------------------+
| @t |
+---------------------+
| 2005-03-21 11:10:17 |
+---------------------+
1 row in set (0.00 sec)
mysql> create table tab ( time_a datetime, time_b datetime);
Query OK, 0 rows affected (0.24 sec)
mysql> insert into tab (time_a, time_b ) values ( @t, @t);
Query OK, 1 row affected (0.00 sec)
Kristian