all groups > sql server programming > july 2003 >
You're in the

sql server programming

group:

RAISEERROR from within constraint?


RAISEERROR from within constraint? Zig Mandel
7/9/2003 11:36:01 PM
sql server programming:
It appears that RAISEERROR cannot be called from a constraint?
If this is the case, how can I display a custom message when validation
fails?
I know I can do it with a trigger, but in my case it will be much harder to
do with a trigger.

It seems an unnecesary restriction that I cannot call RAISEERROR from a
contraint, in fact it seems to me that would be the most appropiate place to
call RAISEERROR so the user can see a customized message when a constraint
fails.

Thanks,

Zig Mandel

Re: RAISEERROR from within constraint? Tibor Karaszi
7/10/2003 8:48:23 AM
Zig,

I'm afraid that I'm just posting to confirm your observations. This is one of the upside with
triggers. I prefer aiming at catching errors in the client and not have the SQL error "shine
through".

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

AddThis Social Bookmark Button