Script to divide data by 2

  • If the values in both columns are the same (and correct) we do not need to do anything to the data. Just change the query that is reporting the incorrect data. If the values in both columns is incorrect (2 X the correct amount) then each column needs to be divided by 2 and updated.

    It must be Monday if I have misunderstood what you said a second time. The bad news is that it is early the good news is that I have to actually do a little work so the chances of me misunderstanding you a third time is remote.

    Mike

  • Mike - I was telling Remi about the 2nd time round misunderstanding...you're too savvy to do any such thing ...however, the bad news is that it IS Monday & the good news is that like you I too have work to catch up on so we'll leave Remi to pick up the pieces and clean up....give him some extra work before he goes on vacation <;-)







    **ASCII stupid question, get a stupid ANSI !!!**

  • I'm still waiting for any type of answer from anyone to this comment/question to go any further in the process. Analysis comes first, not last .

  • These are the correct steps...

    1.  Press the green button

    2.  Restore from backup

    3.  Analyze

    4.  Repeat

  • Yup... but we don't even know if it's possible. We haven't heard from him since he posted the question.

    Nice link BTW, feels like home (127...).

  • I wish someone would double some of the information in our payroll...

  • ...we should be so lucky...but mainly no one should be sent to divide by 2 if this happens...







    **ASCII stupid question, get a stupid ANSI !!!**

  • Gentlemen,

    First off I've already fixed the problem. All I had to do was divide the info in both columns by 2. Each column contained the same incorrect information because the application program puts the data in 2 different columns (who knows why). Each column has a distinct name.

    Thanks for all the help and all the discussion on this.

  • Alright, HTH.

  • Do you need to divide EACH column's value by 2?  If so you need

    SELECT col1/2, col2/2   rather than (col1+col2)/2

    Once you are are sure you are getting the correct data, you change the SELECT statement to an UPDATE statement to actually change the data.

    As someone pointed out earlier, you should make very sure you need to update the values in both columns.  Best to get the user's blessing before you start changing data.

    If you really want to get your accounting people's attention tell them:

    "We don't need no stinkin adjusting journal entries.  We can just change the database."

  • >> "We don't need no stinkin adjusting journal entries. We can just change the database." <<

    Imagine the auditors turning up and asking how a certain figure was arrived at... "oh, we just changed it to that... see?"

  • These might come in handy :

    A quote from rudy komacsar

    time for:

    exec sp_update_resume

    possibly time for:

    exec sp_distribute_resume

  • "We don't need no stinkin adjusting journal entries.  We can just change the database."

    I love it the bean counters would be

Viewing 13 posts - 16 through 27 (of 27 total)

You must be logged in to reply to this topic. Login to reply