CASCADE - 2

  • Ron McCullough

    SSC Guru

    Points: 63877

    Comments posted to this topic are about the item CASCADE - 2

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • kapil_kk

    SSC-Insane

    Points: 21316

    +1 today 🙂

    Last time for DELETE cascade question I lose the points so this time first I prefer to refer BOL before answering this question 😛

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Raghavendra Mudugal

    SSChampion

    Points: 10658

    Good one, thank you for posting;

    I actually selected 1 and 4 and really not sure what crossed my mind and I ended up selecting the other two... which lead to #facepalm; (and my friend sitting next to me, observes, ... and goes... "what happened man... did your gf dumped you?" and that lead to #headdesk)

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • kapil_kk

    SSC-Insane

    Points: 21316

    Why today there are no replies from people? :w00t::w00t:

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • paul.knibbs

    SSCoach

    Points: 15270

    This seemed so simple I went and ran the code, sure there must be a catch of some kind--turns out there wasn't, it was as simple as is seemed at first viewing. 🙂

  • Koen Verbeeck

    SSC Guru

    Points: 258965

    Easy one, thanks!

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

  • TomThomson

    SSC Guru

    Points: 104773

    Apart from the messed up wording of the answer options this is a good question.

    It would have been a better question if more care had been taken with editing the answer options.

    And intensly I dislike the horrible violation of 1NF - code examples like this risk teaching really awful habits to inexperienced people who see them.

    Tom

  • mtassin

    SSC-Insane

    Points: 23099

    Glad I got this one right... after the last two where I knew the correct answer and just picked the wrong one... I as getting skeered



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Thomas Abraham

    SSChampion

    Points: 10761

    Thanks for the question Ron.

    I'm developing a bit of paranoia. Even when the question is easy for me, I figure that I am missing something.

    As Andy Grove said, only the paranoid survive. (They require therapy and medication. But they survive!)

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • (Bob Brown)

    SSCrazy

    Points: 2705

    Thanks for the great question.

  • kevin.l.williams

    SSCarpal Tunnel

    Points: 4916

    L' Eomot Inversé (3/26/2013)


    And intensly I dislike the horrible violation of 1NF - code examples like this risk teaching really awful habits to inexperienced people who see them.

    I'm very embarrassed to ask this but how does the code example violate 1NF?

  • TomThomson

    SSC Guru

    Points: 104773

    kevin.l.williams (3/26/2013)


    L' Eomot Inversé (3/26/2013)


    And intensly I dislike the horrible violation of 1NF - code examples like this risk teaching really awful habits to inexperienced people who see them.

    I'm very embarrassed to ask this but how does the code example violate 1NF?

    Look at the construction of the field OrderDetailID in insertion code. You'll see that the orderdetailID (a single column) is constructed as an integer which when written out in decimal notation has the detail number within the order for which it is being created in the LS three digits and the order number in the more significant digits. This violates the principle that a row contains a single atomic value in each column, never multiple values in a single column - because here we have an order number and an order detail detail number both in the same column in each row.

    Tom

  • Hugo Kornelis

    SSC Guru

    Points: 64685

    I think you're reading a bit too much into the code used to create some sample data, Tom. I suspect ROn used this method to eaily visualize which rows belong together, but not with any other intention.

    Of course, it is indeed bad practice to form values like this and store them as single column for real data. But for some sample code, I don't object to it.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • SqlOnMyMind

    SSCertifiable

    Points: 5049

    Hugo Kornelis (3/26/2013)


    I think you're reading a bit too much into the code used to create some sample data, Tom. I suspect Ron used this method to easily visualize which rows belong together, but not with any other intention.

    Of course, it is indeed bad practice to form values like this and store them as single column for real data. But for some sample code, I don't object to it.

    +1 - It's just a simple loop to generate some sample data.

  • Dana Medley

    SSCertifiable

    Points: 6764

    Ez Pz. No got'cha in this question. Thanks!



    Everything is awesome!

Viewing 15 posts - 1 through 15 (of 28 total)

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