You must Sign In to post a response.
  • Category: SQL Server

    How to insert multiple records if not exists in table

    I have one table with columns, "Book", "Chapter".
    Also, I have one screen from where, user can send records in bulk for insertion in above table.
    I want to write a query to insert bulk records if not exists by comparing 2 columns.
    Please help me.
  • #769578
    Hi Pranjal,

    Such problems can be handled in sql server using Merge statement. You can check if record does not exist then Insert other wise perform some other work.

    Using Merge you can insert,update,delete in a single statement.


    Anjali Bansal

    ~Give your best and lead the world

  • Sign In to post your comments