Are the posted questions getting worse?

  • Chad Crawford (10/10/2011)


    Evil Kraig F (10/10/2011)


    Sean Lange (10/10/2011)


    Craig Farrell


    Liverwurst always comes to worst....

    Yeah, I'm a bit loopy today. :hehe:

    Today??? πŸ˜›

    Hmmmmm.....

    WHILE @TargetStatus = 'Conscious'

    BEGIN

    EXEC spr_BeatWithSalami @Target = 'Sean'

    SET @TargetStatus = (SELECT AwakeStat FROM tblTargets WHERE fname = 'Sean')

    IF @TargetStatus = 'Unconscious'

    BEGIN

    EXEC spr_DumpBucketOfWaterOnHead @Target = 'Sean'

    SET @TargetStatus = 'Conscious'

    END

    END

    πŸ˜€

    Alright guys, lets help Craig get out of his loop-e-ness by coming up with a set-based solution. Craig, help us help you - can you post the DDL for the procs listed here?

    :-P:-P:-P:-P:-P:-P:-P

    Not sure if that is possible. One definition of set logic might be "all the work is done at once" and hence there is an implied ending condition. As you can see from Craig's code there is no ending condition. Hence, a set-based solution would need to prove the theory of perpetual motion, and this would violate the laws of physics.

    QED: there is nothing that can be done for Craig's loopiness without destroying the universe.

    But wait! There is a logic bug in Craig's code: "SELECT AwakeStat FROM tblTargets WHERE fname = 'Sean'" might return NULL.

    Steve.

  • Fal (10/10/2011)


    But wait! There is a logic bug in Craig's code: "SELECT AwakeStat FROM tblTargets WHERE fname = 'Sean'" might return NULL.

    Oh, yeah, that one. That's in case the entry is moved in the EF mechanism from 'tblTargets' to 'tblHasBiggerGun' or 'tblSavedByPrettyWoman'. I left out the try/catch wrapper. In catch, there's an execution of spr_RunLikeHell that makes sure we're good to go. πŸ˜‰

    I always did like Ray Bradbury's take on Perpetual Motion:

    β€œIt's perpetual motion; the thing man wanted to invent but never did. . . . It's a mystery. . . . Its real beauty is that it destroys responsibility and consequences . . . clean, quick, sure; nothing to rot later. Antibiotic, aesthetic, practical.”

    -- Fahrenheit 451, Ray Bradbury


    - 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

  • Evil Kraig F (10/10/2011)


    In catch, there's an execution of spr_RunLikeHell...

    Heh. That sounds like a good name for an RBAR sproc if ever I saw one.

    Edit: Hey, I'll add my own to the RBAR sproc list: spr_AbandonHopeAllYeWhoRunThisCode

    Steve.

  • Well I totally failed to remember to take a photo of a really dressed-up SA fan on Sunday, but here's one of a really nice guy we met on the train on the way down to the game...

  • Evil Kraig F (10/10/2011)


    Chad Crawford (10/10/2011)


    Alright guys, lets help Craig get out of his loop-e-ness by coming up with a set-based solution. Craig, help us help you - can you post the DDL for the procs listed here?

    :-P:-P:-P:-P:-P:-P:-P

    Hell no, I'm highly embarassed by it. I needed to use xp_cmdshell because I was too lazy to look into some convoluted alternates. :w00t: All the tables are non-ISO standard naming, too. It's just bad.

    That and the data's very dirty. Do you know hard it is to CLEAN a salami?! Especially when all your water's going on heads! GIGO man... gigo.... They ain't pretty.

    ... okay, I'll stop now. Probably. πŸ˜‰

    Aww.... I was just about to jump on the non-ISO standard naming, too...

    I guess I'll just go sit over here, drink my coffee, and sulk about not being at PASS.

    -Ki

  • Fal (10/10/2011)


    But wait! There is a logic bug in Craig's code: "SELECT AwakeStat FROM tblTargets WHERE fname = 'Sean'" might return NULL.

    <inserts copy/paste argument from multiple other threads on the use of NULL, its definition as an unknown state, how it is actually implemented in SQL Server by version, whether or not tblTargets should have AwakeStat defined as NOT NULL and whether acceptable values for AwakeStat should include a value for an unknown state, and whether or not the unknown state in which Sean might be is the same as the unknown state in which another fname in the table might be...>

    Yeah. Right. I'll just step away from the keyboard now and go back to figuring out why this server is misbehaving... 😎

    -Ki

  • Kiara (10/11/2011)


    Fal (10/10/2011)


    But wait! There is a logic bug in Craig's code: "SELECT AwakeStat FROM tblTargets WHERE fname = 'Sean'" might return NULL.

    <inserts copy/paste argument from multiple other threads on the use of NULL, its definition as an unknown state, how it is actually implemented in SQL Server by version, whether or not tblTargets should have AwakeStat defined as NOT NULL and whether acceptable values for AwakeStat should include a value for an unknown state, and whether or not the unknown state in which Sean might be is the same as the unknown state in which another fname in the table might be...>

    Yeah. Right. I'll just step away from the keyboard now and go back to figuring out why this server is misbehaving... 😎

    We can just change it to a count so we don't have to worry about nulls.

    select count(*) from tblTargets WHERE fname = 'Sean' and AwakeStat <> 'BeatenIntoSubmissionBySalami'

    (0 row(s) affected)

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (10/11/2011)


    Kiara (10/11/2011)


    Fal (10/10/2011)


    But wait! There is a logic bug in Craig's code: "SELECT AwakeStat FROM tblTargets WHERE fname = 'Sean'" might return NULL.

    <inserts copy/paste argument from multiple other threads on the use of NULL, its definition as an unknown state, how it is actually implemented in SQL Server by version, whether or not tblTargets should have AwakeStat defined as NOT NULL and whether acceptable values for AwakeStat should include a value for an unknown state, and whether or not the unknown state in which Sean might be is the same as the unknown state in which another fname in the table might be...>

    Yeah. Right. I'll just step away from the keyboard now and go back to figuring out why this server is misbehaving... 😎

    We can just change it to a count so we don't have to worry about nulls.

    select count(*) from tblTargets WHERE fname = 'Sean' and AwakeStat <> 'BeatenIntoSubmissionBySalami'

    (0 row(s) affected)

    You see right away that you lied about this. The actual result is :

    (1 row(s) affected) with a count.

    So I'll go ahead and assume at least 1 in that count!

  • Ninja's_RGR'us (10/11/2011)


    Sean Lange (10/11/2011)


    Kiara (10/11/2011)


    Fal (10/10/2011)


    But wait! There is a logic bug in Craig's code: "SELECT AwakeStat FROM tblTargets WHERE fname = 'Sean'" might return NULL.

    <inserts copy/paste argument from multiple other threads on the use of NULL, its definition as an unknown state, how it is actually implemented in SQL Server by version, whether or not tblTargets should have AwakeStat defined as NOT NULL and whether acceptable values for AwakeStat should include a value for an unknown state, and whether or not the unknown state in which Sean might be is the same as the unknown state in which another fname in the table might be...>

    Yeah. Right. I'll just step away from the keyboard now and go back to figuring out why this server is misbehaving... 😎

    We can just change it to a count so we don't have to worry about nulls.

    select count(*) from tblTargets WHERE fname = 'Sean' and AwakeStat <> 'BeatenIntoSubmissionBySalami'

    You see right away that you lied about this. The actual result is :

    (1 row(s) affected) with a count.

    So I'll go ahead and assume at least 1 in that count!

    (0 row(s) affected)

    Further proof that the salami beat me into a place of complete fogginess and disorientation. πŸ˜‰

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Die thread Die:pinch:

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Here's something fun for those of us unlucky enough to not be at PASS.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • Stefan Krzywicki (10/11/2011)


    Here's something fun for those of us unlucky enough to not be at PASS.

    Sweet

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Stefan Krzywicki (10/11/2011)


    Here's something fun for those of us unlucky enough to not be at PASS.

    Nice.

    /* Anything is possible but is it worth it? */

  • Well, I found Gail's book at the PASS Bookstore, but they won't let me buy it. πŸ™

    Some wild story about the bookstore not opening for another 15 minutes. What a load of cursors.

  • Stefan Krzywicki (10/10/2011)


    Roy Ernest (10/10/2011)


    Grant started and I am scared of heckling him... He looks scary.

    He's not scary! If worse comes to worse, buy him a beer after and all will be fine.

    Dang, what I good idea. I should have brought them some brews to start the day off! πŸ™‚

    They were truly awesome. I loved how their synergy flowed between them... you wouldn't believe that they had not practiced this precon together.

    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 - 30,796 through 30,810 (of 66,738 total)

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