By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,626 Members | 1,653 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,626 IT Pros & Developers. It's quick & easy.

Need Help, RaiseError, Check Constraint or Rules

P: 4
Hi! Im new in this forum..

Obviously I need help,
Is there a way I can make a Custom Error Message using RaiseError statement?

This is the problem, I want an error message whenever a user break a rule or a check constraint. I know there's a system error message for that but I want it customize that a user will understand what the error was about. And I just want it in a particular Rule or Check Constraint not all..

Im just new in SQL so Please help me out.. A sample statement would be nice
I hope i made sense to you..
Mar 15 '08 #1
Share this Question
Share on Google+
3 Replies


P: 4
oh Yea, Im using MS SQL 2000 in 2000Advance Server...

I actually have an idea but i can't put it into syntax..

My Idea is,,

I will create a RaiseError Message.. or something like that

then I will create a StoreProcedure that everytime user violates a check constraint or rule it will trigger/call the RaiseError i made..

is that possible??!!!
Mar 15 '08 #2

ck9663
Expert 2.5K+
P: 2,878
use combinations of:

1. @@error

2. BEGIN TRY...END TRY BEGIN CATCH...END CATCH

3.RAISERERROR


Happy Coding

-- CK
Mar 15 '08 #3

P: 4
use combinations of:

1. @@error

2. BEGIN TRY...END TRY BEGIN CATCH...END CATCH

3.RAISERERROR


Happy Coding

-- CK
@@error = 'msg ID' is that the one?

i never use try and catch before.. would you give me some sample syntax?
just one...
does it works in sql2000?

thanks man, appreciate it
Mar 15 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.