INSERT INTO

  • A typo again, and again, and again.

    How many should we report to get someone control the code before posting?:-D

  • good question!


    [font="Times New Roman"]rfr.ferrari[/font]
    DBA - SQL Server 2008
    MCITP | MCTS

    remember is live or suffer twice!
    the period you fastest growing is the most difficult period of your life!
  • palotaiarpad (9/15/2011)


    A typo again, and again, and again.

    How many should we report to get someone control the code before posting?:-D

    1. First al all I always test my code before submitting for consideration to be selected to be a QOD.

    2. Second read prior comments in this forum and you will see that Steve Jones acknowledged reformatting my code and in so doing he made a mistake. After all we are all human, not machines.

    3. Of prime importance, did you learn anything when attempting to answer this QOD. If you did then the true objective of the QOD, that is teaching, has been satisfied.

    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]

  • Following quote, high lighting added by this poster

    Stuart Davies (9/15/2011)


    Thanks for the question. I've only submitted a couple over the years and know how quick others are to jump on your mistakes / typos (easily done though).

    Sweated over this one for a few minutes though before working it out.

    It appears that the QOD has become a game for some. Something like I did as a child, that is kick the can,after all it (the can) can not kick back. Oh well such is life. One must learn to take the good with the bad.

    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]

  • 1. It wasn't against you, i'm sure, everyone who sends a snippet for selection is doing tests before.

    But it should be selfmandatory for the editor to test if something has been changed.

    2. Yes, i learned something. Use a test system before EVERY change 😎

    3. If the QOD-s are here for bring us new ideas or to fresh up some forgotten knowledge, if it's the real sense of it, then it can't be a puzzle to get the right question - based on the given answers - you have to answer to. A teacher may fail one time or two times. But several times in a row not. The students will lose all the respect and will hate the classes.

  • as with everyone else. 2nd select returns 1 not 2.

    Thanks for the credit Steve 🙂

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • bitbucket-25253 (9/15/2011)


    Following quote, high lighting added by this poster

    Stuart Davies (9/15/2011)


    Thanks for the question. I've only submitted a couple over the years and know how quick others are to jump on your mistakes / typos (easily done though).

    Sweated over this one for a few minutes though before working it out.

    It appears that the QOD has become a game for some. Something like I did as a child, that is kick the can,after all it (the can) can not kick back. Oh well such is life. One must learn to take the good with the bad.

    Just a thought - how many of those complaining about any QOTD have submitted a QOTD themselves(and how many have been perfectly written)

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • Stuart Davies (9/15/2011)


    bitbucket-25253 (9/15/2011)


    Following quote, high lighting added by this poster

    Stuart Davies (9/15/2011)


    Thanks for the question. I've only submitted a couple over the years and know how quick others are to jump on your mistakes / typos (easily done though).

    Sweated over this one for a few minutes though before working it out.

    It appears that the QOD has become a game for some. Something like I did as a child, that is kick the can,after all it (the can) can not kick back. Oh well such is life. One must learn to take the good with the bad.

    Just a thought - how many of those complaining about any QOTD have submitted a QOTD themselves(and how many have been perfectly written)

    Even when written really well, there will be some that will find a mistake.

    I like Ron's comment about the objective being "learning."

    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

  • Stuart Davies (9/15/2011)


    bitbucket-25253 (9/15/2011)


    Following quote, high lighting added by this poster

    Stuart Davies (9/15/2011)


    Thanks for the question. I've only submitted a couple over the years and know how quick others are to jump on your mistakes / typos (easily done though).

    Sweated over this one for a few minutes though before working it out.

    It appears that the QOD has become a game for some. Something like I did as a child, that is kick the can,after all it (the can) can not kick back. Oh well such is life. One must learn to take the good with the bad.

    Just a thought - how many of those complaining about any QOTD have submitted a QOTD themselves(and how many have been perfectly written)

    I have written some, and I have also made mistakes while writing it and was appropriately drawn and quartered for said mistake. :w00t:

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Toreador (9/14/2011)


    A good question, unfortunately it came down to "guess the typo". Fortunately I guessed right that the values inserted into cuss2 were supposed to be the same as those inserted into cuss1.

    Normally, I'm a good sport and I played "Guess the Typo" with an open mind. Unfortunately, I lost today.

    Not trying to kick the can...er...bucket. I appreciate the effort to submit the question and I understand from reading the discussion that the typo was introduced by the editors, not the original author. I don't think the typo has been fixed, however: The second select statement still returns 1.

  • When i see "Second Select return 0 or 2" i think "Ey! this guy want 'Isert into..Values(1 .. 1 .. 1? oo 1...2...2 like the first example?"

    That drive to "Second select returns 2" 🙂

  • How could it be possible to insert same cid in second table if I create a primary key on this field.

    As per my view I can put only single record with the same value in a primery key field.

  • For the second table, only one Insert will take place.

    CREATE TABLE dbo.Cuss2

    (cid int NOT NULL, cut varchar(25) NOT NULL,

    ph varchar(20) NOT NULL, adx varchar(50) NOT NULL,

    CONSTRAINT PK_Cuss2 PRIMARY KEY(CID)

    );

    GO

    SET NOCOUNT OFF

    INSERT INTO dbo.Cuss2( cid, cut, ph, adx)

    VALUES (1, 'cust 1', '(111) 111-1111', 'address 1');

    INSERT INTO dbo.Cuss2( cid, cut, ph, adx)

    VALUES (1, 'cust 2', '(222) 222-2222', 'address 2');

    INSERT INTO dbo.Cuss2( cid, cut, ph, adx)

    VALUES (1, 'cust 2', '(222) 222-2222', 'address 2');

  • I need my points The second will return 1 only.

  • My guesses were the same as yours. I've just tried the code on SQL-Server MS 2005 and empirically SSMS agrees with us also. The official answer is not correct in my situation.

Viewing 15 posts - 76 through 90 (of 122 total)

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