Solved

Error number listing

Posted on 2007-03-26
6
3,255 Views
Last Modified: 2008-01-09
Hi Experts,

I try to catch errors from Sql Server 2005 and find that error number:2627 is "Violation of unique constraint".
Where can I find all other code numbers ?
I need "Violation of unique index" code in particular.
Can I set my  own code without override system codes ?

Thanks in advance for your help.
0
Comment
Question by:noulouk
  • 3
  • 2
6 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 250 total points
Comment Utility
SELECT * FROM master..sysmessages WHERE description LIKE '%violation%'

>Can I set my  own code without override system codes ?
No
0
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
>>Can I set my  own code without override system codes ?<<
You can add custom message.  Is that what you mean?  If so check out sp_addmessage in BOL
0
 
LVL 9

Author Comment

by:noulouk
Comment Utility
Thanks that helps me very much.
I found 15306 error codes from 21 to 33020.
I mean when I use RAISERROR: can I send the custom error "100001" ?
So, my own errors starts from 100001 to the last int number.

Don't you do like this to catch your error instead of parsing the RAISERROR message string ?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
>>Don't you do like this to catch your error instead of parsing the RAISERROR message string ?<<
No, I do not use custom messages.  I rely on my front-end app to handle that.
0
 
LVL 9

Author Comment

by:noulouk
Comment Utility
Sorry, but I don't understand what you mean:
"I rely on my front-end app to handle that." (do you use a RETURN VALUE ?)
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 250 total points
Comment Utility
That is one option, although somewhat limited.  An output varchar parameter can return the error message.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now