• sabarish (5/14/2010)


    Hi Everyone ,

    I need to insert about 20 records to a database table.... Which is the better approach -

    1) inserting one record at a time

    2) concantening the insert queries using a semicolon and executing it as a batch

    Regards

    Sabarish

    Neither is better, they are essentially the same.

    Have you considered putting the 20 rows into a temp table or table variable and running as a single INSERT?

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden