Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

Datetime Question Options
marygrl2327
Posted: Tuesday, June 24, 2008 4:54:46 PM

Rank: Newbie

Joined: 6/13/2008
Posts: 7
Points: 21
Location: TX
Is there anyway you can exclude time from a datetime format? For example, our tables display dates as datetime. I want to look at 2 columns that are in datetime format, but I only want to pick up dates in one column that are greater than dates in the other column.

If I simply say:

where create_date > job_date

it gives me this sample result:

Create Date
2/15/08 10:55:55

Job Date
2/15/08 12:02:15


I don't want to say:

where datepart(dd,create_date) > datepart(dd,job_date)

because that has the possibility of giving me this result:

Create Date
1/15/08 10:55:55


Job Date
2/17/07 9:32:25

I've looked through help topics on SQL 2005, but I can't find anything to give me just a date format.

Any help is greatly appreciated. Thanks!

~Mary~

What's with today, today?
marygrl2327
Posted: Tuesday, June 24, 2008 5:09:16 PM

Rank: Newbie

Joined: 6/13/2008
Posts: 7
Points: 21
Location: TX
And wouldn't you know it, after I posted this topic I figured out what I could do to solve my problem.

1) Use the convert function

or

2) Use datediff: where datediff(dd,create_date,job_date) > 1

Cool

What's with today, today?
Scott Whigham
Posted: Friday, June 27, 2008 1:57:19 PM


Rank: Super Mod

Joined: 3/20/2006
Posts: 345
Points: 748
Location: Dallas, TX
I'm so glad we could help Wink
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnWindows2003.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.