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

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 September 13th, 2004, 10:15 AM
Jammo Jammo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 Jammo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 56 sec
Reputation Power: 0
Question SQL Statement "broken" ?

Hello all,
I'm completely baffled as to why a certain SQL statement will not work, and thought maybe you might be able to lend a hand.

I have a table called FMOutOfOffice, with (currently) 4 records in it. The Table fields are:
- ID (pk)
- Name (str)
- Date (date)
- Reason (str)
- Delegate (str)

My 4 records are currently this:

1 Name1 09/09/2004 Holiday2 Name10
2 Name2 10/09/2004 Holiday3 Name12
3 Name3 08/09/2004 Holiday1 Name13
4 Name4 09/09/2004 Holiday4 Name14

Where the dates in each record are the following respectively:
09/09/2004
10/09/2004
08/09/2004
09/09/2004

This statement works correctly, and returns all 4 records:
strSQL = "SELECT * FROM FMOutOfOffice"

This statement also works correctly, and returns 2 records:
strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#09/09/2004#;"

However, this next sql statement returns no records, even though the date DOES exist:
strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#08/09/2004#;"

This one also does not work
strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#10/09/2004#;"

Am I missing something incredibly simple here?

Many thanks in advance for any help you may offer

Kind regards,
- James


Reply With Quote
  #2  
Old September 13th, 2004, 10:19 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
What database are you using?

Reply With Quote
  #3  
Old September 13th, 2004, 10:24 AM
Jammo Jammo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 Jammo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by Memnoch
What database are you using?

It's (currently) an Access DB on the intranet, but I've never had this problem before with previous test Access DBs.

Is there anything that you can see?

Reply With Quote
  #4  
Old September 13th, 2004, 10:52 AM
Jammo Jammo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 Jammo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 56 sec
Reputation Power: 0
Solved

Quote:
Originally Posted by Jammo
Hello all,
I'm completely baffled as to why a certain SQL statement will not work, and thought maybe you might be able to lend a hand.

I have a table called FMOutOfOffice, with (currently) 4 records in it. The Table fields are:
- ID (pk)
- Name (str)
- Date (date)
- Reason (str)
- Delegate (str)

My 4 records are currently this:

1 Name1 09/09/2004 Holiday2 Name10
2 Name2 10/09/2004 Holiday3 Name12
3 Name3 08/09/2004 Holiday1 Name13
4 Name4 09/09/2004 Holiday4 Name14

Where the dates in each record are the following respectively:
09/09/2004
10/09/2004
08/09/2004
09/09/2004

This statement works correctly, and returns all 4 records:
strSQL = "SELECT * FROM FMOutOfOffice"

This statement also works correctly, and returns 2 records:
strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#09/09/2004#;"

However, this next sql statement returns no records, even though the date DOES exist:
strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#08/09/2004#;"

This one also does not work
strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#10/09/2004#;"

Am I missing something incredibly simple here?

Many thanks in advance for any help you may offer

Kind regards,
- James


Solved it.

It's to do with International Date settings, as I'm from the UK, I still have to use US date format of mm/dd/yy. *OR* I use the DateValue() command which is what I've done.

New SQL query :
strSQL = "SELECT * FROM FMOutOfOffice WHERE date=DateValue('10/09/2004');"

Thanks anyway for your time,
- James

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > SQL Statement "broken" ?


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 3 hosted by Hostway
Stay green...Green IT