Is there mysql's INSERT IGNORE equivalent in MS SQL Server 2005 or something similar?
+1
A:
you can implement something like this with an INSTEAD OF trigger, intercepting the default insert action to perform updates where existing rows are detected. Not quite as out-of-the-box as the MySql variation, but more flexible.
davek
2010-05-03 19:11:49
A:
I don't know what your application is - maybe the REPLACE
could help?!
Philipp Andre
2010-05-03 19:18:55
No such functionality in MS SQL Server apart from text replace. There is a MERGE but SQL2008 only.
Martin Smith
2010-05-03 19:20:50
+1
A:
I'm not familiar with the mysql INSERT IGNORE feature, but the documentation I am reading makes it sound like all it does is ignore(silently fail) attempts to insert a record with a primary key that already exists in the table.
If that is what you are looking for, SQL Server has a similar functionality, but you have to apply it to the primary key or unique constraint when you create it.
Read about the IGNORE_DUP_KEY option of a unique index.
Chris Shaffer
2010-05-03 19:36:15