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

Discussion in 'ASP General' started by Hebar Tiltwobler, Oct 24, 2003.

  1. 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
    Hebar Tiltwobler, Oct 24, 2003
    #1
    1. Advertising

  2. Hebar Tiltwobler

    Ray at Guest

    "Hebar Tiltwobler" <> wrote in message
    news:%...

    >
    > 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
    Ray at, Oct 24, 2003
    #2
    1. Advertising

  3. Hebar Tiltwobler

    Bob Barrows Guest

    Hebar Tiltwobler wrote:
    > 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

    --
    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"
    Bob Barrows, Oct 24, 2003
    #3
  4. "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:%...
    >
    > "Hebar Tiltwobler" <> wrote in message
    > news:%...
    >
    > >
    > > 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
    >
    >


    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?
    Hebar Tiltwobler, Oct 24, 2003
    #4
  5. "Bob Barrows" <> wrote in message
    news:%...
    > Hebar Tiltwobler wrote:
    > > 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
    >
    > --
    > 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.
    Hebar Tiltwobler, Oct 24, 2003
    #5
  6. Hebar Tiltwobler

    Bob Lehmann Guest

    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

    "Hebar Tiltwobler" <> wrote in message
    news:...
    >
    > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    > news:%...
    > >
    > > "Hebar Tiltwobler" <> wrote in message
    > > news:%...
    > >
    > > >
    > > > 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
    > >
    > >

    >
    > 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?
    >
    >
    >
    Bob Lehmann, Oct 24, 2003
    #6
  7. Hebar Tiltwobler

    Ray at Guest

    "Hebar Tiltwobler" <> wrote in message
    news:...
    >
    > > 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?
    >


    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

    >
    >
    Ray at, Oct 24, 2003
    #7
  8. "Bob Lehmann" <none> wrote in message
    news:...
    > 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
    >
    > "Hebar Tiltwobler" <> wrote in message
    > news:...
    > >
    > > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    > > news:%...
    > > >
    > > > "Hebar Tiltwobler" <> wrote in message
    > > > news:%...
    > > >
    > > > >
    > > > > 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
    > > >
    > > >

    > >
    > > 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?
    > >
    > >
    > >

    >
    >



    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.
    Hebar Tiltwobler, Oct 24, 2003
    #8
  9. "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:%...
    >
    > "Hebar Tiltwobler" <> wrote in message
    > news:...
    > >
    > > > 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?
    > >

    >
    > 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.
    Hebar Tiltwobler, Oct 24, 2003
    #9
  10. Hebar Tiltwobler

    Bob Barrows Guest

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

    >

    Oops. Sorry about that.

    Bob


    --
    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"
    Bob Barrows, Oct 24, 2003
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. falcon
    Replies:
    10
    Views:
    18,641
    Roedy Green
    Feb 24, 2006
  2. Vivek Mandava
    Replies:
    28
    Views:
    2,190
    ArWeGod
    Sep 11, 2003
  3. Massimiliano Alberti

    Find Greater or Equal

    Massimiliano Alberti, Feb 20, 2004, in forum: C Programming
    Replies:
    3
    Views:
    391
    David Rubin
    Feb 20, 2004
  4. Iain
    Replies:
    1
    Views:
    1,974
    nahid
    Jul 16, 2007
  5. Dwight Army of Champions
    Replies:
    4
    Views:
    2,745
    John H.
    Mar 17, 2010
Loading...

Share This Page