SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Question of the Day for 17 Oct 2005


Question of the Day for 17 Oct 2005

Author
Message
Site Owners
Site Owners
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: Administrators
Points: 18531 Visits: 219
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.
Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)

Group: General Forum Members
Points: 153598 Visits: 9672
...and that's just the way it should be .
cliffb
cliffb
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2335 Visits: 438
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.



Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)

Group: General Forum Members
Points: 153598 Visits: 9672
There's still no other possible somewhat right answer... if the trigger fails, the whole transaction has to fail.
Yelena Varshal
Yelena Varshal
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18628 Visits: 608

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

cliffb
cliffb
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2335 Visits: 438

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.





Peter Kryszak
Peter Kryszak
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2550 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.



Adam Machanic
Adam Machanic
SSCertifiable
SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)

Group: General Forum Members
Points: 6851 Visits: 735
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
whoisactive
fga100
fga100
SSC-Enthusiastic
SSC-Enthusiastic (145 reputation)SSC-Enthusiastic (145 reputation)SSC-Enthusiastic (145 reputation)SSC-Enthusiastic (145 reputation)SSC-Enthusiastic (145 reputation)SSC-Enthusiastic (145 reputation)SSC-Enthusiastic (145 reputation)SSC-Enthusiastic (145 reputation)

Group: General Forum Members
Points: 145 Visits: 10
The question didn't state that the statement that caused the trigger to fire was running inside a transaction.



Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)SSC Guru (153K reputation)

Group: General Forum Members
Points: 153598 Visits: 9672
Doesn't matter. There's always a transaction to rollback if a major error occurs.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search