SQL Prompt warns about UPDATE triggers
GregWilson
Posts: 1 New member
in SQL Prompt
When running a TSQL statement similar to:
Two issues:
CREATE TRIGGER [dbo].[trgPersonalFinancialHeaderModified] ON [dbo].[PersonalFinancialHeader] AFTER UPDATE NOT FOR REPLICATION AS UPDATE d SET Modified = getdate() FROM [dbo].[PersonalFinancialHeader] d inner join inserted i on d.Modified = i.Modified AND d.[AccountNum] = i.[AccountNum] AND d.[StatementDate] = i.[StatementDate];SQL Prompt throws a warning pop-up: "Execution warning You're about to execute an UPDATE statement without a WHERE clause on: PersonalFinancialHeader d"
Two issues:
- I'm not executing an UPDATE statement, I'm executing a CREATE TRIGGER statement
- A trigger UPDATE statement, when inner joined to the "inserted" pseudo-table has no need for a where clause, making this warning ridiculous.
Tagged:
Answers
Sorry for the delayed response, but I wanted to get a second set of eyes on what you were seeing. I don't know if it's good news or bad news, but I was able to duplicate the scenario you described. I have escalated to the development team so they can determine the correct course of action to provide a resolution. In the interim, there are options available to you.
The last option leaves the rule active and inplace, it just doesn't warn you if you try to execute code that 'breaks' a rule. See the screenshot below, your CREATE TRIGGER isn't showing any errors, while my UPDATE statement does show the green squiggly line that indicates a rule violation.
I hope this helps. Please let me know if you have any further questions.
Thank you,
Lee Givens
Product Support Engineer