• Thomas Abraham (5/16/2012)


    Thanks for the question.

    Got it wrong, and I even ran a test. Code below:

    CREATE TABLE #Temp(Col1 INT NOT NULL

    CONSTRAINT PK_QOTD_1 PRIMARY KEY (Col1))

    INSERT #Temp(Col1) VALUES (1)

    INSERT #Temp(Col1) VALUES (1)

    INSERT #Temp(Col1) VALUES (2)

    GO

    SELECT * FROM #Temp

    (not exactly the same code as the question, but functionally equivalent) Only got one row back from SELECT, as I had anticipated.

    So, what have I got wrong here?

    No idea what went wrong. I copied and pasted the code above, hit execute, and got two rows back. SQL Server 2012. What version are you running?


    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/