I have many records and I want to fire a batch insert query in MYSQL
and MSSQL
using JDBC
:
My query is : INSERT INTO dentalitems SET itemID = ?, categoryid = ?, treatmentAreaID = ?, paintTypeID=?, procedurecode=? ON DUPLICATE KEY UPDATE itemID = ?, procedurecode = ?
The query above is working fine for MYSQL
- it will insert the record into the table but if there is a duplicate key then it will perform an update.
My problem is that I want to perform the same above operation in SQL Server also but the query above is only for MYSQL
. I searched for an SQL Server query but I did not find any.
In my table itemID
and procedurecode
are unique columns.
How can I do the same thing with MSSQL Server?