• First, let me state flatout that I'm NOT an anti-CLR zealot. I'm also NOT an anti-Cursor zealot. They both have their places and their uses.

    Much like the use of Cursors, though, I've seen some pretty bad misuse of SQLCLR. I've seen people write a CLR to do a Modulus function because they didn't know enough about T-SQL to realize what the "%" operator was. I've seen people write random number generators that took a lot longer than the old hack of ABS(CHECKSUM(NEWID())). And, I even had one fellow write a CLR to do an "UPSERT" because he didn't know T-SQL well enough to do it there.

    By the same token, I've seen some wonderful uses of SQLCLR such as some very high performance and flexible character based splitters, a "Tally Table" CLR, a much better and more flexible "Pivot", and some remarkable stuff that Adam Machanic has done.

    To wit, if someone actually does write a "Stairway" for SQLCLR, I'd really like to see some important research and explanations as to what is appropriate for SQLCLR and what is not. Just like Cursors, SQLCLR should not be used as a comfort zone replacement for more appropriate T-SQL or SQL Server knowledge.

    --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.


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