Solved

custom message in constraint fail in SQL

Posted on 2003-11-14
6
209 Views
Last Modified: 2012-06-22
welll sorry experts for assigning less points!!!!i don't have the points.

i have foll questions like:

1. I have added a constrainst in my table on one field. Now when i am trying to insert the records(which violates the constrainst) an error message is generated. Now can i custmize this error message.

2. For some other table I am raising the error message insidde a trigger using raiserror command. Is it possible to raise a message instead of an error message. Inside my application, it shows only the OK button. Is it possible to send a message with YES/NO button. As far as i know it is not possible. Just to confirm it.

3. The reason why i am doing all this is because our client has brought a package from outside agency. Now we have got the responsibility to add business logic in this package thry Backend(SQL) using triggers etc. Are there any other ways i can implement busiess logic in this application.

I know i have very less points. As soon as i will get more points i will keep on adding!!!
0
Comment
Question by:pg_india
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9752970
Please maintain your many old open questions:

1 03/20/2003 50 CD KEY INSTALLATION  Open Windows Security
2 03/22/2003 50 CRYSTAL REPORT  Open Crystal Reports
3 09/09/2003 100 CRYSTAL REPORT/ASP  Open Crystal Reports
4 07/05/2003 70 FLASH DOWNLOAD ICON  Open Macromedia Flash
5 08/05/2003 70 SNMP SERVICE  Open VB Controls
6 08/27/2003 100 NETWORK BANDWIDTH THRU VB  Open Networking
7 09/30/2003 75 HOW TO USE GETPIXEL  Open Visual Basic

Thanks,
Anthony
0
 
LVL 34

Expert Comment

by:arbert
ID: 9753067
You cannot customize the constraint error messages.  Generally, you capture the errors in your front-end application and re-display the errors as something meaningful to your client.


"2. For some other table I am raising the error message insidde a trigger using raiserror command. Is it possible to raise a message instead of an error message. Inside my application, it shows only the OK button. Is it possible to send a message with YES/NO button. As far as i know it is not possible. Just to confirm it.
"

What  are you using to create your application?  You should be able to present the user with a form or message box that contains Yes/No....
0
 
LVL 3

Author Comment

by:pg_india
ID: 9753224
Thanks Albert for your help and acperkins yes i am closing my old question.Don't worry abt it.See i have increased the points by 100.

Basically its a exe which we have got from third party. So weccont change anythg in it. Should i assume then that it is not possible from SQL Server.

Also i want to know:
Are there any other ways i can implement busiess logic in this application??

Any help will be apprecirated.


0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 34

Expert Comment

by:arbert
ID: 9753250
So if you can't change the application, how would you possibly change the business logic in it?????

If you can't change the application, it pretty much becomes a training issue--that's the way it is and you just train your users to get use to it.

Can you request the vendor make more descriptive error messages?

Brett
0
 
LVL 3

Author Comment

by:pg_india
ID: 9753295
i understand that but usiness logic can be implemented at SQL level also. Not 100% but we can do some validations etc etc. Now i want to know various ways of doing that through SQL as the application is able to handle SQL errors and display them.

An example is suppose i don't want user to enter age in negative in table "customer" lets say age field. Now i can write a trigger on customer where i can do validation that if age <=0 then raiseerror with some error number and the application is able to show that error. This much i have completed but i need to know if there any other ways of doing the same. Can i send some message also instead of the error message!!!
0
 
LVL 34

Accepted Solution

by:
arbert earned 120 total points
ID: 9754736
Nope, you're stuck with the sql errors....Also, instead of the trigger--use a constraint--best practice.....

Personally, if I had to code a bunch of extra logic on the backend to handle stuff like that--I would be searching for a different front end.....
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

627 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