IS string date greater than or equal to a SQL server datetime record?

H

Hebar Tiltwobler

I need to figure out if the current date (passed in as a string) is equal
to or greater then a field in my database in the format of- M/D/YYYY AND if
the date is less then another field in my database.


"... WHERE '" & cdate(request("date")) & "' >= CONVERT(varchar,
(datePart(M,appointmentStart)/datePart(D,appointmentStart)/datePart(YYYY,app
ointmentStart)), 103)) AND "&_
"'" & cdate(request("date")) & "' <= (CONVERT(varchar,
(datePart(M,appointmentEnd)/datePart(D,appointmentEnd)/datePart(YYYY,appoint
mentEnd)), 103)) "


Anyone know why my SQL statement above is not working correctly?

PS- I've always wondered why it less thEn instead of less thAn ..? Doesn't
thAn make more sense?


TIA
 
R

Ray at

PS- I've always wondered why it less thEn instead of less thAn ..? Doesn't
thAn make more sense?

Where are you seeing less thEn? I can see myself saying that in
conversation. "We can each take 50%. If you want less, then give me more."

Ray at work
 
B

Bob Barrows

Hebar said:
I need to figure out if the current date (passed in as a string) is
equal to or greater then a field in my database in the format of-
M/D/YYYY AND if the date is less then another field in my database.

Dates are not stored with any format. It is up to the client application to
apply formatting. I suspect your database is SQL Server (why are you making
us guess? :) ), so if you look up Using Date And Time Data in SQL Books
Online, you will find your answer.
Anyone know why my SQL statement above is not working correctly?

PS- I've always wondered why it less thEn instead of less thAn ..?
Doesn't thAn make more sense?
I always say/write "less than". I don't know why you think "less then" is
the accepted form.

HTH,
Bob Barrows
 
H

Hebar Tiltwobler

Ray at said:
Where are you seeing less thEn? I can see myself saying that in
conversation. "We can each take 50%. If you want less, then give me more."

Ray at work

Whoops.. was thinking of VBscript.. > then..

I'm wondering why it is not less than instead of then. Isn't "than"
comparitive and "then" a reference to time?
 
H

Hebar Tiltwobler

Bob Barrows said:
Dates are not stored with any format. It is up to the client application to
apply formatting. I suspect your database is SQL Server (why are you making
us guess? :) ), so if you look up Using Date And Time Data in SQL Books
Online, you will find your answer.

I always say/write "less than". I don't know why you think "less then" is
the accepted form.

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"




Dates are not stored with any format. It is up to the client application to
apply formatting.
Correct

I suspect your database is SQL Server (why are you making
us guess? :) ),

Subject line says SQL Server


so if you look up Using Date And Time Data in SQL Books
Online, you will find your answer.



Thank you.
 
B

Bob Lehmann

Less than is correct. Did you hear "then" or see "then"? Maybe you ran into
a regional accent.

Gotta go now, the cah's erl needs to be changed.

Bob Lehmann
 
R

Ray at

Hebar Tiltwobler said:
Whoops.. was thinking of VBscript.. > then..

I'm wondering why it is not less than instead of then. Isn't "than"
comparitive and "then" a reference to time?

www.dictionary.com
just kidding

If 5 is greater than 4 then do this

That's how VBS is, although I wouldn't be surprised if things were messed up
grammatically from time to time. I don't know too many programmers who are
expert grammarians. I try though! I don't use "a lot" or say things like,
"If someone has a cat, they are cool." Who's they? It's he, damn it! And
enough with all that "he or she" or "s/he" nonsense!

Ray at work
 
H

Hebar Tiltwobler

Bob Lehmann said:
Less than is correct. Did you hear "then" or see "then"? Maybe you ran into
a regional accent.

Gotta go now, the cah's erl needs to be changed.

Bob Lehmann


I was thinking (not really) of "less than" or "greater than" (<>) and
"then"... what I'm really trynig to say is that I woke up too early this
morning.
 
H

Hebar Tiltwobler

Ray at said:
www.dictionary.com
just kidding

If 5 is greater than 4 then do this

That's how VBS is, although I wouldn't be surprised if things were messed up
grammatically from time to time. I don't know too many programmers who are
expert grammarians. I try though! I don't use "a lot" or say things like,
"If someone has a cat, they are cool." Who's they? It's he, damn it! And
enough with all that "he or she" or "s/he" nonsense!

Ray at work

Tomaytoe tomot-o, potatoe, now that I've invented the internet I'm going
back to bed.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top