Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2007-03-19 : 14:43:10
|
Guys,I have datetime datatype field populated with date '1919-02-23 00:00:00.000' and I also have varchar datatype field which stores time. How can I manipulate sql statement to add time to the existing date field. I have tried below 2 sql statements but it didnt seem to workRECDATE2 DATETIME '1919-02-23 00:00:00.000'cBTIME VARCHAR(4) '0152'UPDATE NBIRTHSET RECDATE2 = SUBSTRING (CAST (RECDATE2 AS VARCHAR), 1, 11)+SUBSTRING (CBTIME, 1, 2)+':'+SUBSTRING (CBTIME, 3, 2)+':00.000'UPDATE NBIRTHSET DATEPART(HH, RECDATE2) = SUBSRTRING (CBTIME, 1, 2)UPDATE NBIRTHSET DATEPART(MI, RECDATE2) = SUBSRTRING (CBTIME, 3, 2)any suggestions/inputs would help Thanks |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-19 : 14:48:43
|
UPDATE Table1SET RecDate2 = RecDate2 + '01:00:00' -- add 1 hourPeter LarssonHelsingborg, Sweden |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
|
|
|
|