Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Incorrect syntax near the keyword 'ON' – SQL Server 2019

Can anyone tell me why the following syntax is resulting in error? I would like to update the ip address field with dynamic ip addresses if a current record exists with a matching primary key.

INSERT INTO Overview([Computername], [IpAddress]) VALUES('test', '127.0.0.1') ON DUPLICATE KEY UPDATE Overview set IpAddress = '127.0.0.1';

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

There is no "ON DUPLICATE KEY" allowed in MS SQL Server. This syntax is only allowed on MySQL.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading