-1

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 FilterMode 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;
    }
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Jones
  • 3
  • 2
  • 1
    I have no idea what you're asking. Can you be more clear? You've tagged this with C#, do you have some code to show us? – David Aug 29 '11 at 12:55
  • Sorry for offtopic but why do you need these? – Yurii Hohan Aug 29 '11 at 12:55
  • It's all about filtering the Error State . so can you suggest me what are the SQl state are specified for the above – Jones Aug 29 '11 at 12:59
  • The state depends upon where in the engine it gets thrown. A given error message may be possible to have different state numbers. Why do you need to know this? You should use Error Number. – Martin Smith Aug 29 '11 at 13:05

2 Answers2

1

ErrorCode == 0x80131904 for Duplicate Error Record. I do not know the code for null value

Yurii Hohan
  • 4,021
  • 4
  • 40
  • 54
1

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459