Is there a way to configure SQL Server to limit the number of rows than an update statement can modify? Say I wanted the limit to be 30,000 rows and someone fired an update that would modify 45,000 rows, they would receive an error or some other preventive message.
Tell me more
×
Database Administrators Stack Exchange is a question and answer site for
database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.
|
migrated from stackoverflow.com Nov 30 '11 at 16:05
|
A trigger would be how I would handle this. This will slow down all your update statements as SQL now has a bunch of extra work to do, but it'll handle your requirement.
Personally I wouldn't like the idea of the instead of trigger and reapplying the update with a smaller row set as this gets into tricky areas of half completed operations now which could get very messy, quickly. |
|||||||||
|
|
You could do this with an AFTER INSERT TRIGGER, and count the number of records in the inserted table, and handle your desired record limit that way. |
|||
|
|
|
You could also use an |
|||
|
|