Query on Date

P

pjscott

I'm using sql 2000 and Access 2003.

I'm trying to query on a TripDate field. I need records that are >= the
current date. In Access I would use >=Date(). When I try this in sql I get an
error.

I've tried using GetDate but all I get are the > records. What do I use to
get both the > and = to records to display?

Thanks,

Paul
 
G

Gary Walter

pjscott said:
I'm using sql 2000 and Access 2003.

I'm trying to query on a TripDate field. I need records that are >= the
current date. In Access I would use >=Date(). When I try this in sql I get
an
error.

I've tried using GetDate but all I get are the > records. What do I use to
get both the > and = to records to display?
Hi Paul,

I think you are seeing the difference between

SELECT GETDATE(),CONVERT(datetime, GETDATE(), 120),CONVERT(char(10),
GETDATE(),120)GO2006-06-08 08:22:19.903 2006-06-08 08:22:19.903 2006-06-08
 
G

Gary Walter

">let's try that again...

I think you are seeing the difference between

SELECT
GETDATE(),
CONVERT(datetime, GETDATE(), 120),
CONVERT(char(10), GETDATE(),120)
GO

2006-06-08 08:22:19.903
2006-06-08 08:22:19.903
2006-06-08
 
P

pjscott

But what do I use to get the TripDate field to display the >= records?

Thanks,

Paul
 
P

pjscott

Thanks Gary that worked.

Is there a book, manual or web site where I can find this type of info?

Again thanks for the help,

Paul
 
G

Gary Walter

"pjscott" <wrote:
Is there a book, manual or web site where I can find this type of info?
the Books OnLine that comes with
SQL Server puts Access help to shame
(although I don't think that the topic
of your post is specifically covered).

When I first started in, I went up and
spent a week at Tom Ellison's. If you
can find some user group in your area,
there's nothing better than someone
who has already been through it.

Since returning, I have bought a bunch
of books.

The one that I used the most initially
was Mary Chipman/Andy Baron's
"Microsoft Access Developer's Guide
to SQLServer" 0-672-31944-6

As I got deeper into things, I keep
learning from Ken Henderson's two
Guru's Guides

"..to Transact-SQL"
"..to SQL Server, Stored Procedures,
XML, and HTML"

I also got a subscription to
"SQL Server Magazine"
but, nowadays, they are mostly
covering 2005 which helps me
not for my job.

I really don't have that much time to
just sit down and read so when I hit
a problem, I will usually Google it first,
then if that doesn't work, go through
BO, then books above. I cannot claim
to having completely read every single
page of the books above, but they have
worked well for finding solutions.

All along I have also kept a "cheat sheet"
that I add to when I find something.
If you are interested, I can post it here,
but it is quite long and word wrap will
probably make some things garbled.

good luck,

gary
 
G

Gary Walter

I forgot to mention "web site"

I was looking for something
and ended up having to create
a free userid on the following website

www.sqlservercentral.com

since, I receive an email every day
which nearly always has at least one
link to something on their site that
I want to know more about.

Boy, I could learn so much if I
just didn't have my job to do as
well. :cool:
 
P

pjscott

Thanks Gary for taking your time to help.

This helps a bunch.

I hope you have a good weekend.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top