|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,040,
Visits: 1
|
|
| Comments posted to this topic are about the Question of the Day for 17 Oct 2005 posted at http://www.sqlservercentral.com/testcenter/qod.asp?QuestionID=623.
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Today @ 4:09 AM
Points: 21,357,
Visits: 9,539
|
|
...and that's just the way it should be .
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Friday, May 03, 2013 11:41 AM
Points: 675,
Visits: 426
|
|
Even though I answered correctly, it would have been nice to have had some psuedo code to help out. I had to read through the question a couple of times to understand it, where as psuedo code would have been more direct. It's just the way I learn, I realize everyone is different. Nice Question.
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Today @ 4:09 AM
Points: 21,357,
Visits: 9,539
|
|
| There's still no other possible somewhat right answer... if the trigger fails, the whole transaction has to fail.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Monday, July 30, 2012 10:42 AM
Points: 3,434,
Visits: 519
|
|
I answered correctly but I wonder if the answer with "The process works normally but produces an error message" could be implemented? Something like in the trigger text: Begin Transaction <update statements> RAISEERROR (with severety level 1 - informational) Commit Transaction I also wonder if the trigger type is "Instead Of" could we make the trigger insert rows but produce the message? Yelena
Regards, Yelena Varshal
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Friday, May 03, 2013 11:41 AM
Points: 675,
Visits: 426
|
|
I guess it is more a friendly critique of the format of the question. It was a little rough to read through, and having psuedo code would have helped me understand the question more easily. I did not have the answers available at the time as I was reading the question from the email.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, July 27, 2010 7:51 PM
Points: 1,244,
Visits: 3
|
|
I think that total failure was the only right answer
If the WHERE clause used IN or EXISTS that two rows returned from the subquery would not cause a failure or any warning, but certainly if it is a boolean operator expecting a singleton, then it would fail.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 3:20 PM
Points: 1,137,
Visits: 667
|
|
I found the whole setup to be somewhat of a red herring. The point is, if the trigger fails everything is going to fail. Doesn't matter if there are foreign keys or not...
-- Adam Machanic SQL Server MVP SQLblog.com: THE SQL Server Blog Spot on the Web
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, March 23, 2011 8:43 AM
Points: 145,
Visits: 10
|
|
The question didn't state that the statement that caused the trigger to fire was running inside a transaction.
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Today @ 4:09 AM
Points: 21,357,
Visits: 9,539
|
|
| Doesn't matter. There's always a transaction to rollback if a major error occurs.
|
|
|
|