I'm looking at some code (I didn't write it!) to test that our code catches two error conditions upon attempting to delete a table row where dependencies exist.

The code originally looked for specific text in the message rather than using the error number.

In order to provide multi language support it would be better to catch the exception based on the error number rather than the error message.

In the test there are two sets of text the code is looking for and I can't seem to ascertain what the difference is, so am uncomfortable just checking for error number 547.

1. The DELETE statement conflicted with the REFERENCE constraint...
2. The DELETE statement conflicted with the SAME TABLE REFERENCE constraint...

Is it safe to assume that both error messages will have an error number of 547?
Cheers
Colin