Violating Foreign Keys

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

  • 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]

  • Easy and too long question.

  • This was removed by the editor as SPAM

  • Nice easy question.

    Maybe a bit too long in the sql.

    Tom

  • 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

  • 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

  • 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]

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

  • 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

  • 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! 🙂

  • 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

  • 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:

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

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

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

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