Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / July 2006



Tip: Looking for answers? Try searching our database.

SQL help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JP Bless - 16 Jun 2006 17:10 GMT
I have a long date field that stores Date like "6/14/2006 11:30:00 AM"
I would like to query this field as short date... like
ssql = "Select DateX from TableY where DateX between 6/14/2006 and
6/15/2006"
So the SQL should ignore the time part.
Please help

thanks in advance
Jeff Johnson - 16 Jun 2006 17:23 GMT
>I have a long date field that stores Date like "6/14/2006 11:30:00 AM"
> I would like to query this field as short date... like
> ssql = "Select DateX from TableY where DateX between 6/14/2006 and
> 6/15/2006"
> So the SQL should ignore the time part.

You have to tack on "11:59:59 PM" to the "high" date. After all these
iterations of SQL Server, you'd think there'd be a function for this or
something, but there isn't.
JP Bless - 16 Jun 2006 17:47 GMT
Thanks Jeff.

> >I have a long date field that stores Date like "6/14/2006 11:30:00 AM"
> > I would like to query this field as short date... like
[quoted text clipped - 5 lines]
> iterations of SQL Server, you'd think there'd be a function for this or
> something, but there isn't.
Chris Anderson - 28 Jul 2006 22:12 GMT
Why tack it on?
the 15th is clearly after the 14th, so even though DateX has 11:30am, it
will still get picked up since it is between the two dates.

As for a function: DateAdd(s, -1, DateAdd(d, 1, @SomeDate))
Will add one day, the take off one second....

Chris Anderson [VB-MVP]

>> I have a long date field that stores Date like "6/14/2006 11:30:00
>> AM"
[quoted text clipped - 5 lines]
> iterations of SQL Server, you'd think there'd be a function for this
> or something, but there isn't.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.