This is a great question! I also work on SQL Server (2k) databases as well as Access and MySQL. I run into the same problem. So far, I've just changed the SQL in my applications, but I also would like to know if a default can be set.

Regards,
Adam

On Apr 18, 2004, at 12:01 AM, Stormblade wrote:

Hey all,

I'm currently converting a SQLServer 2000 database over to MySQL. I have a
web application that currently uses SQLServer but will be using MySQL soon
as I can get this done.


I was able to match data types but so far I have not found a way to let the
database handle setting the default value of a datetime field to the
current date/time. Is this possible?


In my research I found 2 main suggestions:

1. Use timestamp. While this suggestion is good for my modified fields it
is not really suitable for the others which basically will get set once and
that's it.


2. Use datetime but specify the date/time in your SQL. This is also not
very suitable for two reasons. One is that it would require me to go
through the web application and change all the SQL which I can do but
rather not. The second reason is that this approach is dangerous. There is
no guarantee that the database is on the same system as the web
application. May not even be in the same timezone. So I prefer a more
loosely coupled design.


If I can't find any other way I will have to go with the second option but
I'd really like to find out a better way if one exists.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Stormblade (Shaolin Code Warrior)
Software Developer (15+ Years Programming exp.)


My System: http://www.anandtech.com/mysystemrig.html?rigid=1683
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to