Warning on delete and update statements if no WHERE clause is specified
It would be nice to get a warning on delete or update statements if you did not specify a where clause.
SQL Prompt 7.2 displays execution warnings before executing DELETE or UPDATE statements without a WHERE clause. You can download the latest version from http://www.red-gate.com/products/sql-development/sql-prompt/
-
Aaron commented
Issue still exists in version 9.5.X. If they have a particular format that they want for updates or deletes with an inner join, that would be useful so we know how to avoid this warning message. I have tried a variety of line formats and set formats but always seem to get this error even on a simple update call.
UPDATE CustPhone
SET Phone = 3051234567
FROM CustPhone
INNER JOIN Customer WITH (NOLOCK)
ON CustPhone.CustomerID = Customer.CustomerID
WHERE CustPhone.Phone = 0
AND CustPhone.PhoneType = 'Mobile'
AND Customer.Name = 'Joe Smith' -
Anonymous commented
"If the deletion is on a table join, I don't want to be told that I have no where clause. The warning is erroneous."
same here, i keep getting this warning, but they definitely have where clauses. they are also deletes with table joins.
-
Todd B commented
If the deletion is on a table join, I don't want to be told that I have no where clause. The warning is erroneous.
-
Kevin Greiner commented
SSMS Boost just added this feature recently.