Reputation: 18379
In the context of MS SQL Server 2005
Is there a way to stop delete, and update sql statements being executed against the database that don't have a WHERE clause?
Ideally it would be nice to restrict this 'blocking' to a set of users/roles.
Upvotes: 0
Views: 451
Reputation: 103647
you could create a trigger that does a ROLLBACK of the update if the row count is the same as the count of rows in the table. if you want that trigger code, leave a comment.
Upvotes: 3
Reputation: 755073
Simply answered: no.
It is your responsibility to make sure you don't send those kind of queries. SQL Server cannot "know" or "find out" when a command is truly missing a WHERE clause, or when it really should be executed without any WHERE.
Upvotes: 2