You can only raise user defined error messages (error 50000 and higher) with
RAISERROR, so you can't mimick system error messages.
Can you tell is what you try to achieve and what the "inabilities" of SQL
Server 2000 are that prevent you from achieving that?
Jacco Schalkwijk MCDBA, MCSD, MCSE
"Johannes Lebek" <joh.lebekgSmPxA.Mde> wrote in message
news:#NKA1nHRDHA.2768tk2msftngp13.phx.gbl...raise> Hi there,
> because of some inabilities of SQL Server 2000, I have to use a trigger to
> enforce referential integrity.
> If an INSERT statement is not allowed to be executed (because of a virtual
> constraint -- the referenced foreign key is not available), I want to(23000)> an error.
> First I was using
> RAISERROR (547, 16, 23000)
> because these are the error code (547), priority (16) and SQL statewas> that are used if the referential constraint would have prevented execution
> of the INSERT statement. [Values are copied from JDBC SQLException that> caught.]
> But this does not work:
> message id 547 is not valid, although it is listed in
> "master.sysmessages" (13000 < msg_id < 2^31)
> state seems to be no SQL state (0 < state < 127)
> I would like to raise the same error that occurs with constraints working.
> How can I achieve this?
> Thanks for your advice,