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 March 3rd, 2005, 08:49 PM
ragepro7's Avatar
ragepro7 ragepro7 is offline
Data Sucking Martian
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: socal
Posts: 301 ragepro7 User rank is Lance Corporal (50 - 100 Reputation Level)ragepro7 User rank is Lance Corporal (50 - 100 Reputation Level)ragepro7 User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 14 h 33 m 22 sec
Reputation Power: 5
How can I select where date = currentdate()?

I am developing a DTS package and one of the things I need to do is grab everything in a table that has a date column based on the current date.

I've got the following:
Code:
 
SELECT	 Class1.*, ListDate
FROM		 Class1
WHERE	 (ListDate = GETDATE())

Now this is fine but my date is formatted mm/dd/yyyy and the SQL date is of course formatted in it's own long way. How can i make my where statement only use the DATE and not the time from the SQL?

Thanks!

Reply With Quote
  #2  
Old March 3rd, 2005, 09:31 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 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 27 m 42 sec
Reputation Power: 470
Try this
Code:
WHERE ListDate = CONVERT(char(10),GetDate(),101)

Reply With Quote
  #3  
Old March 3rd, 2005, 09:41 PM
ragepro7's Avatar
ragepro7 ragepro7 is offline
Data Sucking Martian
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: socal
Posts: 301 ragepro7 User rank is Lance Corporal (50 - 100 Reputation Level)ragepro7 User rank is Lance Corporal (50 - 100 Reputation Level)ragepro7 User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 14 h 33 m 22 sec
Reputation Power: 5
Thumbs up

Sweet! Works like a charm!

Reply With Quote
  #4  
Old March 4th, 2005, 09:25 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 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 27 m 42 sec
Reputation Power: 470
Review my signature above about "Helpful Posts" and showing appreciation by adding to someones reputation.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > How can I select where date = currentdate()?


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