469,081 Members | 1,817 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,081 developers. It's quick & easy.

updating table with datetime

OK, I have a datetime field in a table and when I ran an update like
so:

UPDATE myTable SET number=2 WHERE ID=50

I had the old datetime information in the table and that got
overwritten when I did the update. Now I am sure there is no way of
getting that back (yup, believe it or not I didn't do a backup) but
just a general question, should i have done the update like so:

UPDATE myTable SET number=2, mydatetimefield=mydatetimefield WHERE
ID=50

to keep the same information in the datetime field?? Just curious. If
anyone can help, it would be greatly appreciated.

JJ
Jul 19 '05 #1
4 6480
Are you sure the column type is datetime and not timestamp? A
timestamp field is automatically updated whenever you insert or update
a row. If that's the case then I believe you are out of luck.

</rob>

ja************@yahoo.com (Jimmy Jim) wrote in message news:<8e**************************@posting.google. com>...
OK, I have a datetime field in a table and when I ran an update likeou a
so:

UPDATE myTable SET number=2 WHERE ID=50

I had the old datetime information in the table and that got
overwritten when I did the update. Now I am sure there is no way of
getting that back (yup, believe it or not I didn't do a backup) but
just a general question, should i have done the update like so:

UPDATE myTable SET number=2, mydatetimefield=mydatetimefield WHERE
ID=50

to keep the same information in the datetime field?? Just curious. If
anyone can help, it would be greatly appreciated.

JJ

Jul 19 '05 #2
Are you sure the column type is datetime and not timestamp? A
timestamp field is automatically updated whenever you insert or update
a row. If that's the case then I believe you are out of luck.

</rob>

ja************@yahoo.com (Jimmy Jim) wrote in message news:<8e**************************@posting.google. com>...
OK, I have a datetime field in a table and when I ran an update likeou a
so:

UPDATE myTable SET number=2 WHERE ID=50

I had the old datetime information in the table and that got
overwritten when I did the update. Now I am sure there is no way of
getting that back (yup, believe it or not I didn't do a backup) but
just a general question, should i have done the update like so:

UPDATE myTable SET number=2, mydatetimefield=mydatetimefield WHERE
ID=50

to keep the same information in the datetime field?? Just curious. If
anyone can help, it would be greatly appreciated.

JJ

Jul 19 '05 #3
I think you are right Rob. That sux, I will have to do some playing
around, but needless to say I screwed up the dates on the records. Oh
well, lessons learned.

Thanks again!

JJ

ro*@microjuris.com (Rob Baxter) wrote in message news:<ac**************************@posting.google. com>...
Are you sure the column type is datetime and not timestamp? A
timestamp field is automatically updated whenever you insert or update
a row. If that's the case then I believe you are out of luck.

</rob>

ja************@yahoo.com (Jimmy Jim) wrote in message news:<8e**************************@posting.google. com>...
OK, I have a datetime field in a table and when I ran an update likeou a
so:

UPDATE myTable SET number=2 WHERE ID=50

I had the old datetime information in the table and that got
overwritten when I did the update. Now I am sure there is no way of
getting that back (yup, believe it or not I didn't do a backup) but
just a general question, should i have done the update like so:

UPDATE myTable SET number=2, mydatetimefield=mydatetimefield WHERE
ID=50

to keep the same information in the datetime field?? Just curious. If
anyone can help, it would be greatly appreciated.

JJ

Jul 19 '05 #4
I think you are right Rob. That sux, I will have to do some playing
around, but needless to say I screwed up the dates on the records. Oh
well, lessons learned.

Thanks again!

JJ

ro*@microjuris.com (Rob Baxter) wrote in message news:<ac**************************@posting.google. com>...
Are you sure the column type is datetime and not timestamp? A
timestamp field is automatically updated whenever you insert or update
a row. If that's the case then I believe you are out of luck.

</rob>

ja************@yahoo.com (Jimmy Jim) wrote in message news:<8e**************************@posting.google. com>...
OK, I have a datetime field in a table and when I ran an update likeou a
so:

UPDATE myTable SET number=2 WHERE ID=50

I had the old datetime information in the table and that got
overwritten when I did the update. Now I am sure there is no way of
getting that back (yup, believe it or not I didn't do a backup) but
just a general question, should i have done the update like so:

UPDATE myTable SET number=2, mydatetimefield=mydatetimefield WHERE
ID=50

to keep the same information in the datetime field?? Just curious. If
anyone can help, it would be greatly appreciated.

JJ

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ray Holtz | last post: by
3 posts views Thread by Brett Romero | last post: by
4 posts views Thread by =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.