SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 13th, 2003, 01:49 AM
coume coume is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: France / Finland
Posts: 13 coume User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[ASP-MSSQL] Date Problem :(

Hello,

I was using this code which was workign well:

conn2Query="SELECT TOP "&PeriodNb&" Name,MAINKEY FROM PDM_PERIODS_3 WHERE (PDM_PERIODS_3.Hidden=0 AND GetDate()>BreakDate) AND MAINKEY NOT IN (SELECT TOP "&StartingPeriod&" MAINKEY FROM PDM_PERIODS_3 WHERE (PDM_PERIODS_3.Hidden=0 AND GetDate()>BreakDate AND BeginDate>'1.1.2001') ORDER BY BreakDate DESC) ORDER BY BreakDate DESC"


I wanted to add a variable in my config file, like that:
JoinDate="1.1.2001"

And then use this variable in my previous code query/line

conn2Query="SELECT TOP "&PeriodNb&" Name,MAINKEY FROM PDM_PERIODS_3 WHERE (PDM_PERIODS_3.Hidden=0 AND GetDate()>BreakDate) AND MAINKEY NOT IN (SELECT TOP "&StartingPeriod&" MAINKEY FROM PDM_PERIODS_3 WHERE (PDM_PERIODS_3.Hidden=0 AND GetDate()>BreakDate AND BeginDate>'"&JoinDate&"') ORDER BY BreakDate DESC) ORDER BY BreakDate DESC"


But now, I get an error...

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E07)
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

I really cannot see any difference between both lines

I really hope, that someone will!

Thanks in advance
Coume

Reply With Quote
  #2  
Old August 13th, 2003, 08:41 AM
WineIsGood's Avatar
WineIsGood WineIsGood is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: New York
Posts: 49 WineIsGood User rank is Private First Class (20 - 50 Reputation Level)WineIsGood User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 m 51 sec
Reputation Power: 6
When using dates in SQL, wrap them in single quotes like this:
... AND myDate > '3/12/2003'
-Dave

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > [ASP-MSSQL] Date Problem :(


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