• Lynn Pettis (2/10/2009)


    I find if you don't read too much into these questions that they are usually fairly easy to answer.

    Hi Lynnn,

    I would usually agree. Not in this case, though. When I read the question and saw the answers, I immediately knew that two of the answers could have been correct.

    Either the author of the question wrote this question to educate people about the existance of the IDENTITY() function, in which case SELECT INTO would be the expected answer. Or the author expected the readers to know about this and wrote the question to warn about some less published and less well-known side effects, in which case SELECT INTO would obviously have been wrong and CREATE TABLE ... INSERT SELECT would have been right.

    Since there is no way to read the mind of the author of the question, I was faced with a 50/50 chance of getting my answer right. I took my chance ... and lost.

    And then I took the opportunity to evangelize about those side effects anyway! 😀


    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/