help - merge datefield & timefield to datetime field in sql2000

  • Thread starter Thread starter Frank Rocco
  • Start date Start date
F

Frank Rocco

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
 
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
 
Back
Top