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 |
|
jjz
Starting Member
31 Posts |
Posted - 2010-02-04 : 08:52:23
|
| Hi may someone please urgently assist.i'm trying to subtract 2 date fields and my intention is to get number of months as the returned field. This is what i have done so far and i'm not convinced it's correct:select ([CREATE DATE] - getdate()) as 'MonthDiff'into #z_temp1from Z_TEMP_CREATEDATE_LAPTOPselect (datediff(month,[MonthDiff],getdate())) as 'Month'into z_temp2from #z_temp1 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-04 : 08:55:14
|
| second one is correct. though if you considering days also calculation should depend on day part also |
 |
|
|
|
|
|