Blocking query with nolock in it

  • Kim Crosser (10/7/2015)


    I always find it scary that anyone (including myself :-)) is doing direct SQL to "fix" individual records. There are too many ways that a malformed statement can wreak havoc on a database, not to mention just leaving a transaction open and locking a table.

    Why not give her one or more stored procedures that do the necessary updates as a clean, safe, and fast transaction?

    The procedure(s) could validate that the criteria supplied match one and only one target record, and then apply the change and show the resulting record (without requiring a "nolock").

    If you are one of us who has screwed up enough tables in the past that we check, double-check, and triple-check everything (and still manage to make an "oops" now and then), an occasional SQL update may be safe, but this sounds like a "user" regularly being allowed to do direct SQL against production tables. :w00t:

    Agreed. And add CHECK constraints and/or triggers as needed to make sure absolutely sure that minimum data quality standards are followed.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing post 16 (of 15 total)

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