• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Just spent hours chasing down a bug

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    Originally posted by DimPrawn View Post
    Symptoms were that all the data in one table was being updated with the same values.

    Been going round in circles.

    Then saw the following SQL lurking amongst a ton of other SQL:

    UPDATE tableName
    SET col1 = @col1,
    col2 = @col2,
    col3 = @col3
    etc
    WHERE primaryKey = primaryKey;


    The missing @ on primaryKey parameter!



    In the old days before senility and long term alcohol abuse I would have spotted that in seconds.


    Trying to learn Access while on the dole, eh?
    Admirable.
    Hard Brexit now!
    #prayfornodeal

    Comment


      #12
      I demand a rate cut for such incompetence!

      Comment


        #13
        Originally posted by MrMark View Post
        The best sql update issue is where you update a (few) record(s) based on records from another table. If you're not careful you can update all the records.
        hmmm bit newbie error that

        would not the use of a WHERE statement solve those problems?

        Comment


          #14
          whats the difference between a noobie and a noob ?



          (\__/)
          (>'.'<)
          ("")("") Born to Drink. Forced to Work

          Comment


            #15
            why didnt you cut and paste the code into here rather than type it out? Is it to protect your client. eg.

            UPDATE mafia_hitlist_2009 etc.

            Comment


              #16
              I did something similar in my Access 97 days. Set performance tests running all night with ...where POST_CODE = 'postcode'
              instead of ...where POST_CODE = [postcode]

              but I was only on about a tenner an hour.

              Comment


                #17
                Originally posted by singhr View Post
                why didnt you cut and paste the code into here rather than type it out? Is it to protect your client. eg.

                UPDATE mafia_hitlist_2009 etc.
                I'm working on the IR35 database for HMR&C


                UPDATE IT_contractors_to_investigate

                Comment


                  #18
                  Originally posted by DimPrawn View Post
                  I'm working on the IR35 database for HMR&C


                  UPDATE IT_contractors_to_investigate

                  A huge collective sigh of relief just went up from CUK as they realised you're doing the coding on this project
                  Hard Brexit now!
                  #prayfornodeal

                  Comment


                    #19
                    Originally posted by MrMark View Post
                    It's a surprisingly good name for a function call!
                    If I ever see in a SQL Statement, code to the effect of

                    UPDATE tableName
                    SET col1 = etc(@col1),
                    col2 = @col2,
                    col3 = @col3
                    WHERE primaryKey = primaryKey;

                    Both You and DP are gonna get the blame

                    Comment


                      #20
                      Originally posted by sasguru View Post
                      A huge collective sigh of relief just went up from CUK as they realised you're doing the coding on this project
                      I'll have it completed before the next millenium.

                      Comment

                      Working...
                      X