469,945 Members | 1,910 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

help - merge datefield & timefield to datetime field in sql2000

Hello,

We have a database that as two datetime fields.
field1 has the date and field2 has the time.
I need to merge field1 & field2 into field1.

Can someone help me with this syntax?

P.S. I did not design the database.<g>

Thanks for the help

Frank
Nov 15 '05 #1
1 1347
Here is a snippet of code I used to do exactly that in an Access database.
Elements 8 and 9 in my ComputerInfo array are Date and Time respectively.
LastDate is the date-time column of a second table, but you could just as
easily write your new value back into the original date column.

// determine date and time of last touch
strComputerInfo[8] = row["CollDate"].ToString().Trim();
strComputerInfo[9] = row["CollTime"].ToString().Trim();

strComputerInfo[8] = strComputerInfo[8].Remove(strComputerInfo[8].Length -
12, 12);
strComputerInfo[9] = strComputerInfo[9].Remove(0, 11);
strComputerInfo[9] = strComputerInfo[8] + " " + strComputerInfo[9];

if (strComputerInfo[9].Length > 0)
LastDate = Convert.ToDateTime(strComputerInfo[9]);
newrow["LastDate"] = LastDate;

I hope this helps.

- carl

"Frank Rocco" <fa*****@hotmail.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Hello,

We have a database that as two datetime fields.
field1 has the date and field2 has the time.
I need to merge field1 & field2 into field1.

Can someone help me with this syntax?

P.S. I did not design the database.<g>

Thanks for the help

Frank

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by ronald.santos | last post: by
5 posts views Thread by CiPiD | last post: by
1 post views Thread by news.microsoft.com | last post: by
1 post views Thread by =?Utf-8?B?YXZucmFv?= | last post: by
reply views Thread by =?Utf-8?B?YXZucmFv?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.