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 |
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2011-02-16 : 04:38:59
|
Dc + convert(char(8), starttime, 108)dc is a datetime fieldstarttime is a text field with a time in itI want if dc is 20110215 11:00' and startime 12:00I want it to return 20110215 12:00what am i doing wrong? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-02-16 : 04:48:22
|
[code]dateadd(day, datediff(day, 0, Dc), 0) + starttime[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-02-16 : 04:56:27
|
ShorterDECLARE @Date DATETIME = '20110215 11:00', @Time VARCHAR(5) = '12:00'-- PesoSELECT DATEADD(DAY, DATEDIFF(DAY, 0, @Date), @Time) N 56°04'39.26"E 12°55'05.63" |
 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2011-02-16 : 05:10:54
|
thanks |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-16 : 10:36:00
|
quote: Originally posted by Peso ShorterDECLARE @Date DATETIME = '20110215 11:00', @Time VARCHAR(5) = '12:00'-- PesoSELECT DATEADD(DAY, DATEDIFF(DAY, 0, @Date), @Time) N 56°04'39.26"E 12°55'05.63"
Variable declaration with assignment will work from version 2008 onwards onlyMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|