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

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 9th, 2003, 02:52 AM
stfndln stfndln is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Belgium
Posts: 1 stfndln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Date to String in SQL statement

Hi,

I have to be able to execute an sql statement which would look something like this.

SELECT *
FROM Table1
WHERE start_date LIKE '*01*'

The problem is this does not work since start_date is from the type date.

How can I convert the start_date field to a string in order to execute the where clause?

Reply With Quote
  #2  
Old September 13th, 2003, 10:55 AM
unatratnag unatratnag is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 312 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 6 sec
Reputation Power: 6
Send a message via AIM to unatratnag
Hi,
This depends on what you want to do...I can't promise you these will all work since this is untested, but it's along these ideas to check out....

If you're not worried about the year:

-- e.g. For January
SELECT *
FROM MyTable
WHERE MONTH(DateField) = 1

Or, if you do need to limit to a specific year:
a)
-- e.g. for January 2003
SELECT *
FROM MyTable
WHERE MONTH(DateField) = 1 AND YEAR(DateField) = 2003

b)
-- e.g. for January 2003
SELECT *
FROM MyTable
WHERE DateDiff(m, DateField, '2003-01-01') = 0

also check out some other date functions that may help you, google around for date functions

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Date to String in SQL statement


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