sql server, composite keys - ignoring duplicate -
is there way prevent sql throwing error when try save record exists. i've got composite key table many-to-many relationship has 2 values, when update model application, tries save records, records exist throw error cannot insert duplicate key
there way of having database ignore these, or have handle in application?
you calling insert
, trying add duplicated keys. error design, , essential. db throwing exception exceptional , erroneous condition.
if are, instead, trying perform "upsert" may need use stored procedure or use merge syntax.
if, instead, don't want update
ignore rows in table, need add exception insert
statement... such as
.... table.key <> interting.key
Comments
Post a Comment