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. Order of operations and Short circuit

Order of operations and Short circuit

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestionannouncement
5 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.
  • K Offline
    K Offline
    Keith Andersch
    wrote on last edited by
    #1

    Hi all, I have a couple of questions that I hoping someone will know off the top of their head regarding SQL Server 2000. 1) Is there a short circuit mechanism in the if/case program controls? I would think so but logic doesn't rule the day unfortunatley. 2) In an update statement, is it necessarily true that a field will be updated in the order it was presented in the update statement? Best Regards, Keith

    P 1 Reply Last reply
    0
    • K Keith Andersch

      Hi all, I have a couple of questions that I hoping someone will know off the top of their head regarding SQL Server 2000. 1) Is there a short circuit mechanism in the if/case program controls? I would think so but logic doesn't rule the day unfortunatley. 2) In an update statement, is it necessarily true that a field will be updated in the order it was presented in the update statement? Best Regards, Keith

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      If you are talking about short circuiting in boolean conditions, then the answer is no. Fields will not necessarily be updated in the order they are presented. Some fields require more work in an update, and (in a multi-processor environment) the operations to do this can happen alongside other parts of the update.

      the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
      Deja View - the feeling that you've seen this post before.

      K M 2 Replies Last reply
      0
      • P Pete OHanlon

        If you are talking about short circuiting in boolean conditions, then the answer is no. Fields will not necessarily be updated in the order they are presented. Some fields require more work in an update, and (in a multi-processor environment) the operations to do this can happen alongside other parts of the update.

        the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
        Deja View - the feeling that you've seen this post before.

        K Offline
        K Offline
        Keith Andersch
        wrote on last edited by
        #3

        wow, no short circuting of booleans, eh? So (X > 0 AND Y < 3), if x is -1 it will still evaluate y < 3? That's crazy! On doing the updates, I kind of figured that. I'm not too familar on what goes on behind the scenes like if it locks the whole record or locks at the field level. I can work with both these issues and will be good to know for the future. Do you know if this is any different in SQL Server 2005? I know my company will be upgrading here sometime in the future ( I have seen the install discs with my own eyes). I just hope that whatever I have done will be easy to port over. :( Best Regards, Keith

        1 Reply Last reply
        0
        • P Pete OHanlon

          If you are talking about short circuiting in boolean conditions, then the answer is no. Fields will not necessarily be updated in the order they are presented. Some fields require more work in an update, and (in a multi-processor environment) the operations to do this can happen alongside other parts of the update.

          the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
          Deja View - the feeling that you've seen this post before.

          M Offline
          M Offline
          M A A Mehedi Hasan
          wrote on last edited by
          #4

          Hello Friend, Happy Valentines Day. Before concluding anything about TSQL short circuiting, I would like to request you to visit http://www.sqlservercentral.com/faq/viewfaqanswer.asp?categoryid=3&faqid=360[^].

          Mehedi Hasan

          P 1 Reply Last reply
          0
          • M M A A Mehedi Hasan

            Hello Friend, Happy Valentines Day. Before concluding anything about TSQL short circuiting, I would like to request you to visit http://www.sqlservercentral.com/faq/viewfaqanswer.asp?categoryid=3&faqid=360[^].

            Mehedi Hasan

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            Very interesting. Well, that throws the conventional wisdom out of the window.:-D

            the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
            Deja View - the feeling that you've seen this post before.

            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