|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
datediff AR~~~
Dear frens,
hope some1 can help me with this: SQL server SELECT DATEDIFF("d",tbl1.field1,12/30/2004) from tbl1 while field1 is "2004-12-29 00:00:00.000" the result return "-36386" i have no idea how it got this number, i was expacting "-1" i think its the problem with the format of dateTime of field1 i try to convert it into date only using SELECT DATEDIFF("d",convert(date,tbl1.field1),12/30/2004) from tbl1 but it return tat date is not a valid type. hope some1 can pls kindly help ....thanks snowbelly |
|
#2
|
||||
|
||||
|
Should't the date you are trying to get a Difference on have ' enclosing them?
try: SELECT DATEDIFF(dd,tbl1.field1,'12/30/2004') from tbl1 |
|
#3
|
|||
|
|||
|
Oh my fren, THANK U!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
been trying for days bcos of this..... u might think its a stupid mistake....haHAHAhhaha anyway, u are the man !!!!! cant say tat u save my life but hey, my fren u did save me lots of my time.... Again THANK U !!!!!!!!!!!!!!!!!!! snowybelly |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > datediff AR~~~ |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|