Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

Triggers 2 Expand / Collapse
Author
Message
Posted Friday, April 26, 2013 4:49 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:49 AM
Points: 13,735, Visits: 10,703
Another interesting question, thanks Hugo.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1446896
Posted Saturday, April 27, 2013 8:27 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 2:20 PM
Points: 2,136, Visits: 870
Good Question.

When I saw the Count(*) I knew that that was where to concentrate.

David
Post #1447303
Posted Tuesday, April 30, 2013 12:13 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, September 3, 2014 11:44 AM
Points: 1,127, Visits: 1,592
Very interesting one.

Vinu Vijayan

For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden
Post #1447900
Posted Wednesday, May 1, 2013 5:20 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, August 26, 2013 11:58 AM
Points: 36, Visits: 14
Yes to me too it is returning only 1 count.

When ist row is being inserted and the trigger fires and there is sucessful insertion and in second insert when trigger fire it dectets the negative values it is erring out.
Post #1448372
Posted Wednesday, May 1, 2013 7:50 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 5:07 PM
Points: 6,002, Visits: 8,266
flangoo (5/1/2013)
Yes to me too it is returning only 1 count.

When ist row is being inserted and the trigger fires and there is sucessful insertion and in second insert when trigger fire it dectets the negative values it is erring out.

Correct. And then the third insert attempt runs (since it is in a new batch), but due to the badly coded trigger, it won't catch the violation, so it will insert two more rows. And then the select returns a count of three.
If you got a different result when test-running the code on your test database, you probably either used an old, out-of-support version of SQL Server, or you made a mistake when copying the code.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1448424
Posted Thursday, May 9, 2013 1:39 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, September 4, 2014 7:40 AM
Points: 3,546, Visits: 2,652
Thats a great question. For some reason last few questions have been very efficient.
Post #1450916
Posted Friday, May 31, 2013 1:39 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 3:24 AM
Points: 1,144, Visits: 299
nice useful question
Post #1458547
Posted Thursday, June 12, 2014 6:57 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 8:39 AM
Points: 2,935, Visits: 239
Lots of trigger questions, thanks.
Post #1580023
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse