Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 3rd, 2005, 10:23 PM
snowbelly snowbelly is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Malaysia
Posts: 12 snowbelly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 33 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old January 3rd, 2005, 11:12 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
ASP Free Specialist (4000 - 4499 posts)
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,376 lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 1 Day 21 h 21 m 31 sec
Reputation Power: 1391
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

Reply With Quote
  #3  
Old January 4th, 2005, 12:16 AM
snowbelly snowbelly is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Malaysia
Posts: 12 snowbelly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 33 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > datediff AR~~~


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway