Violating Foreign Keys

  • chrisfradenburg

    SSCrazy Eights

    Points: 9592

    Comments posted to this topic are about the item Violating Foreign Keys

  • Ron McCullough

    SSC Guru

    Points: 63877

    A lot of reading of the T-SQL but a GOOD question ...

    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]

  • Carlo Romagnano

    SSC-Insane

    Points: 21872

    Easy and too long question.

  • This was removed by the editor as SPAM

  • TomThomson

    SSC Guru

    Points: 104772

    Nice easy question.

    Maybe a bit too long in the sql.

    Tom

  • Andre Guerreiro

    SSCertifiable

    Points: 7319

    As Paul White would say, this is one of those questions that turns us into a T-SQL parser. 😀

    But nice question.

    Almost got it wrong because I couldn't see the error in query #7 (there were 5 values being passed to 4 columns).

    Thank you.

    Best regards,

    Best regards,

    Andre Guerreiro Neto

    Database Analyst
    http://www.softplan.com.br
    MCITPx1/MCTSx2/MCSE/MCSA

  • Thomas Abraham

    SSChampion

    Points: 10761

    codebyo (10/25/2011)


    Almost got it wrong because I couldn't see the error in query #7 (there were 5 values being passed to 4 columns).

    #7 fails because personname is declared NOT NULL in the table def, I believe.

    Nice question. Didn't realize that FK constraints aren't checked if a NULL is present, as I don't recall having declared a FK on columns where I allowed nulls.

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

  • Ron McCullough

    SSC Guru

    Points: 63877

    Rather surprised that as of this posting only 44 percent of those answering had answered correctly.

    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]

  • jeff.mason

    SSCrazy Eights

    Points: 9555

    bitbucket-25253 (10/25/2011)


    Rather surprised that as of this posting only 44 percent of those answering had answered correctly.

    I at least missed it because, in the midst of all of the boxes, I checked the wrong one by mistake.

  • SQLRNNR

    SSC Guru

    Points: 281243

    Thanks for the question.

    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

  • OzYbOi d(-_-)b

    Hall of Fame

    Points: 3944

    nice question but boy am i glad i had an extra coffee this morning! made me work a little harder today sifting through all the code! 🙂

  • Andre Guerreiro

    SSCertifiable

    Points: 7319

    Thomas Abraham (10/25/2011)


    #7 fails because personname is declared NOT NULL in the table def, I believe.

    Yes, you're right. I was so sure that there were five values being passed.

    Thanks for the correction.

    Best regards,

    Best regards,

    Andre Guerreiro Neto

    Database Analyst
    http://www.softplan.com.br
    MCITPx1/MCTSx2/MCSE/MCSA

  • jwbart06

    Hall of Fame

    Points: 3291

    Ron,

    I missed it because ,

    query 4

    although inserts a record from the second insert statement,

    the first insert statement fails, I guess rendering that query failed,even though something has been inserted.

    This is why 74% missed query 4 , and only 66% missed query 5 and 7.

    Very trickey, also I did the bonehead move of not selecting 3 answers, I need to pay more attention to what the question is asking. :hehe:

  • Ken Wymore

    SSCoach

    Points: 16487

    Nice question, took awhile to get through but a nice question nonetheless.

  • Revenant

    SSC-Forever

    Points: 42467

    Nice question - it boils down to attention to detail burried in the code.

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

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