Are the posted questions getting worse?

  • I would think that a trigger to try to catch errors in other places would be mostly useless for a lot of code but I don't see anything wrong with having error handling in a trigger especially if it's related to what the trigger is actually doing.  For example, it's impossible to enforce DRI across databases with FKs.  You'd need a trigger for that and it would probably be a good idea to have some error handling in it because the other database could be offline, damaged, whatever.   "It Depends".

     

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • That might also be the reason why they've done the RBAR thing in the trigger.  They don't want to have everything during and Insert or Update roll back if something isn't right and so try to handle it row by row.  Is it an "Instead of" trigger by any chance?

     

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden wrote:

    That might also be the reason why they've done the RBAR thing in the trigger.  They don't want to have everything during and Insert or Update roll back if something isn't right and so try to handle it row by row.  Is it an "Instead of" trigger by any chance?

    Good point, Jeff. That's actually a strong argument to treat it as a set. The transaction should either completely work or not work, not partially work. That's how an ACID DB transaction is supposed to work. By doing RBAR in a trigger, they're allowing a transaction to partially work. In the immortal words of Yoda, "Do or do not. There is no try." 😀

    • This reply was modified 1 month, 3 weeks ago by  Ed Wagner.
  • Ed Wagner wrote:

    Jeff Moden wrote:

    That might also be the reason why they've done the RBAR thing in the trigger.  They don't want to have everything during and Insert or Update roll back if something isn't right and so try to handle it row by row.  Is it an "Instead of" trigger by any chance?

    Good point, Jeff. That's actually a strong argument to treat it as a set. The transaction should either completely work or not work, not partially work. That's how an ACID DB transaction is supposed to work. By doing RBAR in a trigger, they're allowing a transaction to partially work. In the immortal words of Yoda, "Do or do not. There is no try." 😀

    Heh... you know me, Ed... "King of the Edge Cases".  There's some really strong exceptions to that.  Here's a real-life exception I've personally run into... and wrote code for as a "help" to someone else last night.

    You receive a file of 30 million CDRs (Call Detail Records).  Even in this day and age, there can be the proverbial burp in a system that drops a byte or two without damaging the file beyond usage.  It just damages one CDR.  Billing of such calls is the lifeblood of the company and the PUC has certain rules about how long you have to actually bill calls not to mention that you have customers that want to do a weekly or maybe even daily analysis of calls.

    Should you really reject all 30 million calls just because one call has a burp in it and everything else is perfect?  Or, do you sequester that CDR for secondary analysis and correction a couple of hours from now and let all the other good CDRs fly on schedule as expected?

    "It Depends" 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

  • Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    Heh... that level was one of the choices in the Sessionize as the "Insanity" Level.  Since my presentation is incredibly heterodoxical to a lot of "knowledge" that has been out there for decades, I figured that was the appropriate level. 😀  To summarize (but please do read the abstract by clicking on the entry), I "DESTROY THE MYTH OF GUID FRAGMENTATION" and "lay waste to what people are currently calling “Best Practice” index maintenance".

    If you haven't seen this one before, it'll totally blow your mind.  For example, did you know that you can use Random GUIDs to PREVENT fragmentation for months at a time?  Have you ever heard of someone inserting 100,000 rows per day into a RandomGUID Clustered Index for 58 days (a total of 5.8 MILLION ROWS) with <1% fragmentation and doing NO INDEX MAINTENANCE for that whole 58 days?   😀

    That's not all that's covered.  I also show you how and why a lot of ever-increasing indexes fragment so quickly and some of the things you can do to fix it and why you should probably avoid the use of NEWSEQUENTIALID()

    You'll also get a copy of the sp_IndexDNA™ tool that I created to allow you to actually see what an index looks like in a graphical form.

    Come one, come all.  Tell your friends.  Make sure that you bring a water-cooled helmet... you're going to need it. 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    There is a limerick that comes to mind, intentionally I´m not including the first part but the second part is

    "It is not as you think

    piddle and pink

    it's big green and eats grass"

    😎

    Jeff's work on the subject has been absolutely brilliant, don't miss this one as it is an eye opener!

  • WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    Eirikur Eiriksson wrote:

    WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    There is a limerick that comes to mind, intentionally I´m not including the first part but the second part is "It is not as you think piddle and pink it's big green and eats grass"

    😎

    Jeff's work on the subject has been absolutely brilliant, don't miss this one as it is an eye opener!

    Eirikur Eiriksson wrote:

    WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    There is a limerick that comes to mind, intentionally I´m not including the first part but the second part is "It is not as you think piddle and pink it's big green and eats grass"

    😎

    Jeff's work on the subject has been absolutely brilliant, don't miss this one as it is an eye opener!

    I'm not familiar with the limerick but thank you for the compliment, Eirikur.

    Like I tell people... I aim to please.  I sometimes miss but I'm always aimin'. 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    It's a funny thing about all of that.  I typed up my entry for EightKB and I got to the part about what level to assign to it.  It had levels 300, 400, and 500.  To be honest, I didn't know which level to assign to it because the content is so very different than most presentations I've ever seen before.  Then I saw it.  They had a level called "Insanity".  I figured that was the most appropriate because when people read the abstract, they think I'm totally insane and when I've finished the presentation, they're pretty much convinced that I had to be a bit insane to be to come up with what I did and actually be able to prove it all.

    I had no idea they were going to print the numbers instead of the word INSANITY and I had no idea that number was going to be 8,192 or 8KB.  All I can say is "Wellahlbe... I didn't know they'd take it to that extent". 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Ok, Eirikur... I'm not familar with the limerick you posted a part of and so I went looking.  I didn't find it but I did find a mountain of different renditions of the "Jack'n'Jill" limerick and now I can't get them out of my head! 😀  So, as your punishment, I wrote one of my own for the occasion.  😀

    Jeff knew the drill

    And went up the hill

    To fix an index or two.

    When he came down

    His head, it did pound

    Cuz he'd fixed the maintenance too!

    rofl

     

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden wrote:

    WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    Eirikur Eiriksson wrote:

    WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    There is a limerick that comes to mind, intentionally I´m not including the first part but the second part is "It is not as you think piddle and pink it's big green and eats grass"

    😎

    Jeff's work on the subject has been absolutely brilliant, don't miss this one as it is an eye opener!

    Eirikur Eiriksson wrote:

    WayneS wrote:

    Steve Jones - SSC Editor wrote:

    FWIW, the 8KB schedule is online: https://eightkb.online/

    Mr. Moden presenting, if you can make it, at Level 8192. Well above the 400-500 level of other sessions.

    So, Jeff is now at the 8K level. Watch out folks, he'll be at 64K in no time. You know how he likes to go from pages to extents...

    There is a limerick that comes to mind, intentionally I´m not including the first part but the second part is "It is not as you think piddle and pink it's big green and eats grass"

    😎

    Jeff's work on the subject has been absolutely brilliant, don't miss this one as it is an eye opener!

    I'm not familiar with the limerick but thank you for the compliment, Eirikur.

    Like I tell people... I aim to please.  I sometimes miss but I'm always aimin'. 😀

    I'll provide the first part on our next SQL Gents chat, don't want to risk being banned from the forums 😉

    😎

    The subtitle is of the book where I read it is: "There are many limericks, erotic and otherwise, none of these are otherwise"

  • Jeff Moden wrote:

    Ok, Eirikur... I'm not familar with the limerick you posted a part of and so I went looking.  I didn't find it but I did find a mountain of different renditions of the "Jack'n'Jill" limerick and now I can't get them out of my head! 😀  So, as your punishment, I wrote one of my own for the occasion.  😀

    Jeff knew the drill And went up the hill To fix an index or two. When he came down His head, it did pound Cuz he'd fixed the maintenance too!

    rofl

    Jeff,

    please do me a favour, do not ever, ever write a sonnet 🙂

    😎

    I'm still laughing!

  • I've registered for the EightKB event, so I can tune in to Jeff's session. Had the confirmation email but no details on how to join. Are these sent closer to the time?

    "Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information upon it. When we enquire into any subject, the first thing we have to do is to know what books have treated of it. This leads us to look at catalogues, and at the backs of books in libraries."
    — Samuel Johnson
    I wonder, would the great Samuel Johnson have replaced that with "GIYF" now?

  • Eirikur Eiriksson wrote:

    Jeff Moden wrote:

    Ok, Eirikur... I'm not familar with the limerick you posted a part of and so I went looking.  I didn't find it but I did find a mountain of different renditions of the "Jack'n'Jill" limerick and now I can't get them out of my head! 😀  So, as your punishment, I wrote one of my own for the occasion.  😀

    Jeff knew the drill And went up the hill To fix an index or two. When he came down His head, it did pound Cuz he'd fixed the maintenance too!

    rofl

    Jeff,

    please do me a favour, do not ever, ever write a sonnet 🙂

    😎

    I'm still laughing!

     

    How about a little Haiku:

    SQL Database

    Statistics are out of date

    Long waits for users

    "Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information upon it. When we enquire into any subject, the first thing we have to do is to know what books have treated of it. This leads us to look at catalogues, and at the backs of books in libraries."
    — Samuel Johnson
    I wonder, would the great Samuel Johnson have replaced that with "GIYF" now?

Viewing 15 posts - 65,506 through 65,520 (of 65,586 total)

You must be logged in to reply to this topic. Login to reply