In MySQL, you can use the feature called --safe-updates (--i-am-a-dummy) to limit the number of rows updated per query.
http://dev.mysql.com/doc/refman/5.0/en/mysql-tips.html#safe-updates
Is there such a thing in MS SQL Server?
|
In MySQL, you can use the feature called http://dev.mysql.com/doc/refman/5.0/en/mysql-tips.html#safe-updates Is there such a thing in MS SQL Server? |
||||
|
|
|
There may or may not be such a thing in MS SQL, but why would you want this? There is already a way to limit what Combining the two, we get the general-case solution: "Do your updates in a transaction, with appropriate WHERE clauses to limit what they touch, and make sure the results look right before you commit":
|
|||||||||||||
|
|
It's per query using TOP if you want.
SET ROWCOUNT has side effects on intermediate counts which gives misleading results, which is why it is slowly being deprecated. The frst MSDN example demonstartes this Luckily, SQL Server as a grown up RDBMS has database snapshots and on-line consistent backups giving point in time recovery in case you foobar it... |
|||||||||||
|
|
I don't believe so - one of the first things I learned was to write a SELECT statement first with the correct WHERE clauses to make sure it is right, and then change the SELECT to an UPDATE. |
|||
|
|
|
If you want to mimic that kind of behavior, there is not much you can do except limit the number of rows using TSQL. Here is an example from the SQL Server Docs:
According to http://msdn.microsoft.com/en-us/library/ms188774.aspx:
Thus, SQL Server 2012 will not allow If you are concerned about queries that can be unintentionally destructive:
Other than these things, all other features of mysql's --safe-updates is totally your responsibility. |
|||||
|