dcsimg
LinkedIn
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

SQL Server - INSERT and ignore on duplicate key

How to insert values and ignore duplicate key errors in SQL Server.


advertisement

Inserting values and ignoring duplicate key errors (or, other errors) can be done like this:

BEGIN TRY
INSERT INTO foo_table (...) VALUES (...)
...
END TRY
BEGIN CATCH
END CATCH


   
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date