All Updates not updating table in sp

  • hi,

    I have about 10 update scripts in a SQL 2005 SP sometimes however they dont all update the table? no error messages are produced?

    I have tried seperating some of the updates into other sps? but still sometimes they do not update?

    any help on this would be awesome!

    Thanks

  • It's impossibile to answer this question without seeing the code.

    Please post table scripts and the stored procedure code.

    If your tables have triggers defined, post their code too.

    -- Gianluca Sartori

  • there are multiple update statements (about 16) in 1 sp all updating the same table but all have different where clauses so cant be completed in 1 update. however at least twice a week some of the updates do not update the data but when you then run them manually through a query they do? so we have to perform a 'data fix' each time.

    UPDATE tblA

    SET Field A = Field B

    WHERE ....

    UPDATE tblA

    SET field c = field d

    WHERE ...

  • sounds like a data problem: either the data being passed in doesn't find anything, causing a failure of some sort, or you're not passing in what you expect (perhaps 'a ' instead of just 'a'). Perhaps use TRY/CATCH mechanisms to see what might be erroring out or IF it was erroring out.

    That said again, without seeing actual code and actual data, it may be very difficult to give you any kind of informed causes. I realize that may be problematic, but right now we're shooting in the dark.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Just taking a guess, there's probably something in the WHERE clause that's preventing you from getting the updates. But, as everyone else has said, without specifics, I'm just guessing.

    However, it seems like the most likely culprit, but I can't tell you specificall what to look at because I'm not there.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

Viewing 5 posts - 1 through 4 (of 4 total)

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