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. Database & SysAdmin
  3. Database
  4. Strnge WHERE syntax

Strnge WHERE syntax

Scheduled Pinned Locked Moved Database
databasecomquestion
6 Posts 3 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.
  • M Offline
    M Offline
    Mel Padden
    wrote on last edited by
    #1

    Has anybody ever seen anything like this in the WHERE clause of an SQL SELECT?

    WHERE a.somenumericvalue = + @somenumericvalue

    I certainly haven't and I don't know what it does. It's kind of difficult to Google for as well so that's why I'm putting it up here. Anyone got any ideas?

    Smokie, this is not 'Nam. This is bowling. There are rules. www.geticeberg.com

    C J 2 Replies Last reply
    0
    • M Mel Padden

      Has anybody ever seen anything like this in the WHERE clause of an SQL SELECT?

      WHERE a.somenumericvalue = + @somenumericvalue

      I certainly haven't and I don't know what it does. It's kind of difficult to Google for as well so that's why I'm putting it up here. Anyone got any ideas?

      Smokie, this is not 'Nam. This is bowling. There are rules. www.geticeberg.com

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      Usually the + sign will have braces around it and appear following the field. Or at least that is how I'm familiar with it. It is for doing an open join on table. Or as I like to think, anything matches on NULL. :)

      where a.ID_Field = b.ID_Field (+)

      All rows from table a will be returned. :)

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

      M 1 Reply Last reply
      0
      • C Chris Meech

        Usually the + sign will have braces around it and appear following the field. Or at least that is how I'm familiar with it. It is for doing an open join on table. Or as I like to think, anything matches on NULL. :)

        where a.ID_Field = b.ID_Field (+)

        All rows from table a will be returned. :)

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        M Offline
        M Offline
        Mel Padden
        wrote on last edited by
        #3

        Yes, I've seen that old join syntax before. It's not what's going on here though. Most strange. I can't even see that it's affecting the logic.

        Smokie, this is not 'Nam. This is bowling. There are rules. www.geticeberg.com

        C 1 Reply Last reply
        0
        • M Mel Padden

          Yes, I've seen that old join syntax before. It's not what's going on here though. Most strange. I can't even see that it's affecting the logic.

          Smokie, this is not 'Nam. This is bowling. There are rules. www.geticeberg.com

          C Offline
          C Offline
          Chris Meech
          wrote on last edited by
          #4

          Would it have anything to do with the bind variable? :)

          Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

          M 1 Reply Last reply
          0
          • C Chris Meech

            Would it have anything to do with the bind variable? :)

            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

            M Offline
            M Offline
            Mel Padden
            wrote on last edited by
            #5

            I can't see how. All this code was ripped out of a ginormous Python framework last year; I'm new on the site. It's possible that this is a concatenation that slipped through, and SQL Server doesn't give a compile error, possibly because it's applying a plus to the bind. Or maybe this is a jury-rigged ABS()? I dunno, but it's queer as folk. I'll ask around tomorrow morning...

            Smokie, this is not 'Nam. This is bowling. There are rules. www.geticeberg.com

            1 Reply Last reply
            0
            • M Mel Padden

              Has anybody ever seen anything like this in the WHERE clause of an SQL SELECT?

              WHERE a.somenumericvalue = + @somenumericvalue

              I certainly haven't and I don't know what it does. It's kind of difficult to Google for as well so that's why I'm putting it up here. Anyone got any ideas?

              Smokie, this is not 'Nam. This is bowling. There are rules. www.geticeberg.com

              J Offline
              J Offline
              jschell
              wrote on last edited by
              #6

              Run the following. Then replace the '-' with a '+'.

              declare @i1 int;
              declare @i2 int;

              set @i1=1;

              set @i2= - @i1;

              select @i2;

              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