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 |
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2005-09-07 : 21:48:53
|
| HiCan i write following conversion in a better way?select Convert(datetime,Convert(varchar,GETDATE(),103),103)+1Thanksmk_garg |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-09-07 : 21:50:44
|
| SELECT DateAdd(day, DateDiff(day, 0, getdate())+1, 0)Don't know if it's better, but it avoids having to convert it to varchar and back. |
 |
|
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2005-09-07 : 22:29:34
|
| Thanksmk_garg |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-09-07 : 22:30:41
|
| I have no doubt it's better. That double conversion can be pretty costly.you could slightly simplify it (although this might be a little less readable)SELECT DateAdd(day, DateDiff(day, 0, getdate()), 1)Be One with the OptimizerTG |
 |
|
|
|
|
|