SQL exceptions for specific error conditions
I want to know SQL exception (state) for the
"Duplicate Error Record"
"Null Value"
What are the sql exception (state) for above ?
Any suggestion
enum FilterMode
{
System_AllData = -1,
System_Error = -2,
System_DuplicateError = 3,
System_NullValues = 2,
}
private Filter开发者_高级运维Mode SetFilter(string str)
{
if (str == "All Record")
return FilterMode.System_AllData;
else if (str == "All Error Record")
return FilterMode.System_Error;
else if (str == "Duplicate Error Record")
return FilterMode.System_DuplicateError;
else if (str == "Null Value")
return FilterMode.System_NullValues;
else return FilterMode.System_Error;
}
You can find an extensive list of error messages here, or you can execute this query to get the ultimate master list of all messages in your SQL Server:
SELECT *
FROM sys.messages
Using a suitable WHERE
clause, I'm sure you can find the ones you're interested in.
ErrorCode == 0x80131904 for Duplicate Error Record. I do not know the code for null value
精彩评论