Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. SQL between

SQL between

Scheduled Pinned Locked Moved The Weird and The Wonderful
sharepointdatabase
11 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wizardzz
    wrote on last edited by
    #1

    Ugh, I just hate the bad usage of BETWEEN in SQL in some legacy SP's at my work. Horrible to use for finding values between a date range, when the date range can be 1 day, ugh!

    "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

    G P 2 Replies Last reply
    0
    • W wizardzz

      Ugh, I just hate the bad usage of BETWEEN in SQL in some legacy SP's at my work. Horrible to use for finding values between a date range, when the date range can be 1 day, ugh!

      "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #2

      I'm not keen on the between keyword either - I always have to test if between means exclude or include the bounds. I much prefer >= and <=.

      Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
      OriginalGriffO 1 Reply Last reply
      0
      • G GuyThiebaut

        I'm not keen on the between keyword either - I always have to test if between means exclude or include the bounds. I much prefer >= and <=.

        Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        I dunno - I do remember that between is inclusive, so I tend to see it as more readable, generally. However, most of the time I do use explicit tests instead, because I don't want to include the upper or lower bound. Ho Hum.

        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        G 1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          I dunno - I do remember that between is inclusive, so I tend to see it as more readable, generally. However, most of the time I do use explicit tests instead, because I don't want to include the upper or lower bound. Ho Hum.

          Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

          G Offline
          G Offline
          GuyThiebaut
          wrote on last edited by
          #4

          I was thinking about why I find something like the word "between" so confusing. I think the reason follows on from the VB versus C# discussion[^] that was going on in the lounge. To explain this it goes something like this for me: if someone told me to kick a ball "between" the goal posts this would mean to me to hit anywhere "inbetween" the goal posts and not hit the goal posts themselves. So for me there is a certain ambiguity in the meaning of "between". Whereas >= and <= holds no ambiguity for me and this is partly why I like C# over VB - the lack of verbosity seems to make it easier for me to understand... Maybe I am just too curmudgeonly...

          Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
          OriginalGriffO W 2 Replies Last reply
          0
          • G GuyThiebaut

            I was thinking about why I find something like the word "between" so confusing. I think the reason follows on from the VB versus C# discussion[^] that was going on in the lounge. To explain this it goes something like this for me: if someone told me to kick a ball "between" the goal posts this would mean to me to hit anywhere "inbetween" the goal posts and not hit the goal posts themselves. So for me there is a certain ambiguity in the meaning of "between". Whereas >= and <= holds no ambiguity for me and this is partly why I like C# over VB - the lack of verbosity seems to make it easier for me to understand... Maybe I am just too curmudgeonly...

            Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            :laugh: Yes, there is a difference between words in English and word in coding languages, generally in terms of precision. The main reasons I prefer C# to VB is that is is more precise: in VB DataRows(17) could be an array element or a function call, in C# the difference is clear. Plus I hate the general use of var, automatic (and normally wrong) casting and don't get me started with On Error Resume Next :laugh:

            Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            R 1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              :laugh: Yes, there is a difference between words in English and word in coding languages, generally in terms of precision. The main reasons I prefer C# to VB is that is is more precise: in VB DataRows(17) could be an array element or a function call, in C# the difference is clear. Plus I hate the general use of var, automatic (and normally wrong) casting and don't get me started with On Error Resume Next :laugh:

              Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

              R Offline
              R Offline
              Robert Rohde
              wrote on last edited by
              #6

              OriginalGriff wrote:

              in VB DataRows(17) could be an array element or a function call, in C# the difference is clear

              As much as I prefer C# over VB.NET this is not true. DataRows[17] could either be an array access or a call to an indexer which is nothing else than a method call. Robert

              L 1 Reply Last reply
              0
              • R Robert Rohde

                OriginalGriff wrote:

                in VB DataRows(17) could be an array element or a function call, in C# the difference is clear

                As much as I prefer C# over VB.NET this is not true. DataRows[17] could either be an array access or a call to an indexer which is nothing else than a method call. Robert

                L Offline
                L Offline
                Lutoslaw
                wrote on last edited by
                #7

                Robert Rohde wrote:

                DataRows[17] could either be an array access or a call to an indexer which is nothing else than a method call.

                An indexer is an operator which is supposed to simulate accessing array's elements by sth like index, so the meaning is clear. A problem appears whe a coder implements an indexer which, for example, serializes an object to a file. However, if a coder knew about a "hidden feature" like indexers the he probably wouldn't be so unwise. In VB, if you see DataRows(17) and know that DataRows is a collection, then you think "well probably it is an indexer".

                Greetings - Jacek

                F 1 Reply Last reply
                0
                • L Lutoslaw

                  Robert Rohde wrote:

                  DataRows[17] could either be an array access or a call to an indexer which is nothing else than a method call.

                  An indexer is an operator which is supposed to simulate accessing array's elements by sth like index, so the meaning is clear. A problem appears whe a coder implements an indexer which, for example, serializes an object to a file. However, if a coder knew about a "hidden feature" like indexers the he probably wouldn't be so unwise. In VB, if you see DataRows(17) and know that DataRows is a collection, then you think "well probably it is an indexer".

                  Greetings - Jacek

                  F Offline
                  F Offline
                  Firo Atrum Ventus
                  wrote on last edited by
                  #8

                  Jacek Gajek wrote:

                  if a coder knew about a "hidden feature" like indexers then he probably wouldn't be so unwise

                  Nicely said :thumbsup:

                  Excuse me for my improper grammar and typos. It's because English is my primary language, not my first language. My first languages are C# and Java. VB, ASP, JS, PHP and SQL are my second language. Indonesian came as my third language. My fourth language? I'm still creating it, I'll let you know when it's done! :-D

                  1 Reply Last reply
                  0
                  • G GuyThiebaut

                    I was thinking about why I find something like the word "between" so confusing. I think the reason follows on from the VB versus C# discussion[^] that was going on in the lounge. To explain this it goes something like this for me: if someone told me to kick a ball "between" the goal posts this would mean to me to hit anywhere "inbetween" the goal posts and not hit the goal posts themselves. So for me there is a certain ambiguity in the meaning of "between". Whereas >= and <= holds no ambiguity for me and this is partly why I like C# over VB - the lack of verbosity seems to make it easier for me to understand... Maybe I am just too curmudgeonly...

                    Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                    W Offline
                    W Offline
                    wizardzz
                    wrote on last edited by
                    #9

                    I agree with you here, it is a totally valid keyword, but ugh. I don't think that way. I feel like since it's not accurate, could be vague or ambiguous, and there is a better alternative, I prefer to use >= <=.

                    "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson My comedy.

                    1 Reply Last reply
                    0
                    • W wizardzz

                      Ugh, I just hate the bad usage of BETWEEN in SQL in some legacy SP's at my work. Horrible to use for finding values between a date range, when the date range can be 1 day, ugh!

                      "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                      P Online
                      P Online
                      PIEBALDconsult
                      wrote on last edited by
                      #10

                      Yar. In my opinion BETWEEN should be >= && <

                      A 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        Yar. In my opinion BETWEEN should be >= && <

                        A Offline
                        A Offline
                        Andy Brummer
                        wrote on last edited by
                        #11

                        Exactamundo. It should be [A,B) because those intervals can be put next to each other without overlap. I've had to deal with a few stored procs that have comments recording the changes from + ' 23:59' to + ' 23:59:59' to + ' 23:59:59.999' etc. as the edge cases were slowly uncovered.

                        Curvature of the Mind now with 3D

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups