• Hugo Kornelis (1/17/2012)


    A good question, and it's hard to see how anbody could contest the correct answer.

    Although in the spirit of nitpicking, I could argue that the format one should use would include the column list in the INSERT statement. And the semicolon statement terminator, that in a future version will no longer be optional.

    INSERT dbo.mytable (Column1, Column2) VALUES ('Test', 'Test2'), ('Test3', 'Test4'), ('test5', 'test6');

    EDIT: Removed the color tag after a few failed attempts to use it - I hope just using bold text emphasises the changes sufficiently.

    Actually if you wanted to nitpick you missed it. Including column names is best practice which doesn't mean you should use it. The correct answer is also the ONLY answer with valid syntax. Maybe your nitpicking can be the wording. Which one of these has the correct syntax? 😀

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/