MSSQL 2005 Server (IIRC) and Python module _mssql.. I have multiple inserts to a table with a single row, which is the primary key.. Now it is possible that I insert the same value multiple times, but I want to simply ignore the "Violation of PRIMARY KEY constraint". Other errors should be raised.
I'm aware that I can try: [...]INSERT[...] except: *magic*: pass
but I couldn't find the exception's name which occurs..
edit:
I don't know whether this solution is acceptable but it's what I've got so far.
try:
con.execute_query('INSERT [...]')
except _mssql.MssqlDatabaseException,e:
if e.number == 2627:
#primary key constraint
pass
else:
raise