Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 18th, 2004, 08:46 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Defined Error Messages

Hi, the situation is, when i try to insert duplicate records into a table, the error message given by sql server is w.r.t error number 2627.

I entered a user defined error message using sp_addmessage 50001, 14, 'No duplicate entries' into the sysmessages table.

but when i trap for @@error <> 0 like

insert into <table> (<column>) values (<value>)
if @@error <> 0
    RAISERROR(50001,14,1)

I see the output like:
<System error message>
<My error message>

Here the user defined error message is appended.

The question is, instead of getting the system defined error message, can only my error message be displayed. Can i program in such a way in order to shunt the system error messages for error numbers like 2627.

TIA
Praveen





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection user-defined type not defined Wall st Guru Excel VBA 2 March 26th, 2014 03:44 PM
User-Defined Type Error - Re: File Dialog Coby Access VBA 1 January 16th, 2008 09:42 AM
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
User-defined type not defined (Icecream.mdb) dloren01 BOOK: Beginning Access VBA 0 June 22nd, 2005 10:36 PM
Application-defined or object-defined error James Excel VBA 1 August 12th, 2003 11:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.