Are the posted questions getting worse?

  • Oh crud... my apologies. Didn't mean to post (gasp!) code on "the thread". :pinch:

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

  • Craig Farrell (1/5/2011)


    Of course, if you really want to mess with your own head, you can always assume because of graph charts and the like that -infinity = infinity, and the number line is actually a circle.

    Isn't a straight line actually a circle with radius equal to infinity? (or something like that, I don't remember, high school is some time ago)

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen (da-zero) (1/6/2011)


    Craig Farrell (1/5/2011)


    Of course, if you really want to mess with your own head, you can always assume because of graph charts and the like that -infinity = infinity, and the number line is actually a circle.

    Isn't a straight line actually a circle with radius equal to infinity? (or something like that, I don't remember, high school is some time ago)

    Heheh, that's from the same inferred math concept. If I remember right the logic proof basically was circular as well. Before anyone quizzes the hell out of me on that though, I'm not a Math Doctorate. I just remember it as one of those 'fun theories' that one of my favorite professors used to use to keep us involved.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Jeff Moden (1/5/2011)


    Personally, I'd prefer a NULL to be returned instead of an error...

    Hmmm. That's an interesting question. I don't like the idea of NULL being overworked (yet again in SQL!) to represent 'attempt to divide by zero'. On balance, I think I prefer the error. You can't legitimately divide by zero, so it's a bug in my code, I would say. Otherwise, why stop there? What should LOG(x) return for x <= 0? NULL again?

    By the way, the following also does what you prefer:

    SET ANSI_WARNINGS, ARITHABORT OFF;

    SELECT 1/0, LOG(-0);

    SET ANSI_WARNINGS, ARITHABORT ON;

    I resist using NULLIF and COALESCE because they can introduce subtle bugs (incorrect results). It seems safer, to me, to expand them into CASE expressions explicitly. The query parser does that anyway.

    Paul

  • Brandie Tarvin (1/5/2011)


    EDIT: Of course, the only reason I want to go on this cruise is for the Cruisiness of it (Caymans, Mexico). The SQL Classes themselves are for beginners.

    I just received an email from SQLCruise this morning. It seems that people were complaining about this, so they have re-worked the schedule (with input from those already signed up). It might be worth your time now.

    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

  • Steve Jones - SSC Editor (1/5/2011)


    Just came back from a neighborhood meeting. Now I need to go shovel more manure around in my barn.

    So, is the second part related to the first part?

    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

  • LutzM (1/5/2011)


    GSquared (1/5/2011)


    ...

    Are you trying to imply that a lump of plastic, metal, and toxic semiconductors can't understand that it's supposed to do what I want, not what I told it to?

    It's not limited to a lump of plastic. There are people showing exactly the same behavior.

    Are those some kind of androids then? πŸ˜€

    Does this mean that female users view computers as male?

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Chris Morris-439714 (1/6/2011)


    LutzM (1/5/2011)


    GSquared (1/5/2011)


    ...

    Are you trying to imply that a lump of plastic, metal, and toxic semiconductors can't understand that it's supposed to do what I want, not what I told it to?

    It's not limited to a lump of plastic. There are people showing exactly the same behavior.

    Are those some kind of androids then? πŸ˜€

    Does this mean that female users view computers as male?

    We can't answer that question on account of the act of answering is a violation of the Femme-Manual NDA. Sorry.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • SQLkiwi (1/6/2011)


    Jeff Moden (1/5/2011)


    Personally, I'd prefer a NULL to be returned instead of an error...

    Hmmm. That's an interesting question. I don't like the idea of NULL being overworked (yet again in SQL!) to represent 'attempt to divide by zero'. On balance, I think I prefer the error. You can't legitimately divide by zero, so it's a bug in my code, I would say. Otherwise, why stop there? What should LOG(x) return for x <= 0? NULL again?

    By the way, the following also does what you prefer:

    SET ANSI_WARNINGS, ARITHABORT OFF;

    SELECT 1/0, LOG(-0);

    SET ANSI_WARNINGS, ARITHABORT ON;

    I resist using NULLIF and COALESCE because they can introduce subtle bugs (incorrect results). It seems safer, to me, to expand them into CASE expressions explicitly. The query parser does that anyway.

    Paul

    Not to insert a technical discussion here, but could you explain how NULLIF and COALESCE introduce subtle bugs. Perhaps start another thread and put the link here or an article or blog post?

  • I also want to encourage all you who are PASS members to opt-in to the session voting for SQLRally. See my this post which has a link to opt-in in case you didn't get the email from PASS.

  • Jack Corbett (1/6/2011)


    Not to insert a technical discussion here, but could you explain how NULLIF and COALESCE introduce subtle bugs. Perhaps start another thread and put the link here or an article or blog post?

    I mentioned it a couple of weeks ago on a Celko thread:

    http://www.sqlservercentral.com/Forums/FindPost1036699.aspx

    Slightly related, why ISNULL is more optimizer-friendly than COALESCE:

    http://www.sqlservercentral.com/Forums/FindPost1021257.aspx

  • Jack Corbett (1/6/2011)


    I also want to encourage all you who are PASS members to opt-in to the session voting for SQLRally. See my this post which has a link to opt-in in case you didn't get the email from PASS.

    And everyone should vote for my sessions, or I will steal your favorite snackage from all the stores in the world and hold it for ransom until you do! Bwahahahahaha.

    Seriously, though. Vote on sessions.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie Tarvin (1/6/2011)


    Chris Morris-439714 (1/6/2011)


    LutzM (1/5/2011)


    GSquared (1/5/2011)


    ...

    Are you trying to imply that a lump of plastic, metal, and toxic semiconductors can't understand that it's supposed to do what I want, not what I told it to?

    It's not limited to a lump of plastic. There are people showing exactly the same behavior.

    Are those some kind of androids then? πŸ˜€

    Does this mean that female users view computers as male?

    We can't answer that question on account of the act of answering is a violation of the Femme-Manual NDA. Sorry.

    I had a glimpse of that once, just one page. It was all questions and answers.

    Q: If he asks this...

    A: It depends.

    All of the answers were "It depends"!

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • SQLkiwi (1/6/2011)


    Jack Corbett (1/6/2011)


    Not to insert a technical discussion here, but could you explain how NULLIF and COALESCE introduce subtle bugs. Perhaps start another thread and put the link here or an article or blog post?

    I mentioned it a couple of weeks ago on a Celko thread:

    http://www.sqlservercentral.com/Forums/FindPost1036699.aspx

    Slightly related, why ISNULL is more optimizer-friendly than COALESCE:

    http://www.sqlservercentral.com/Forums/FindPost1021257.aspx

    Thanks. I use ISNULL when only evaluating 2 values and COALESCE when more than 2.

    I believe they way they deal with different data types in the arguments is different as well.

  • Brandie Tarvin (1/6/2011)


    Jack Corbett (1/6/2011)


    I also want to encourage all you who are PASS members to opt-in to the session voting for SQLRally. See my this post which has a link to opt-in in case you didn't get the email from PASS.

    And everyone should vote for my sessions, or I will steal your favorite snackage from all the stores in the world and hold it for ransom until you do! Bwahahahahaha.

    But only if her session doesn't conflict with mine... they you need to vote for mine! :w00t: πŸ˜› πŸ˜€

    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

Viewing 15 posts - 22,981 through 22,995 (of 66,749 total)

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