Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #1066
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Newsgroups | comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming |
| Subject | Re: Constraint Errors: What Blew Up? |
| Date | 2012-05-22 11:12 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <7uknr7d6cbm5gqflccvhlq9ocdeqrd0ada@4ax.com> (permalink) |
| References | <8khlr79ocjoqh62jhp6ebup8qns4j5d5fp@4ax.com> <XnsA05B602B0E999Yazorman@127.0.0.1> |
Cross-posted to 2 groups.
On Tue, 22 May 2012 07:27:13 +0000 (UTC), Erland Sommarskog
<esquel@sommarskog.se> wrote:
>Gene Wirchenko (genew@ocis.net) writes:
>> If a constraint of some sort is violated, how can I find out
>> which one?
>>
>> Yes, I can parse the error message hoping to find it, but, as
>> pointed out by Erland, that is subject to the error message being
>> changed. I prefer to avoid kludges.
>>
>> Is there a function that returns this value?
>>
>> Anyone for an error_constraint() function?
>
>You can always try to raise your voice on
>http://connect.microsoft.com/SqlServer/FeedBack
>It helps if you can explain this from a business perspective.
"try" is the word. Apparently, a Windows Live id is required and
one has already been created for my E-mail address. I might have
tried to create one years ago and had it fail somehow.
>But for now, you will have to parse the error message. You can stick it into
>a function, so if the message is changed in a futre version of SQL Server,
>you only have to change the function.
That will be a lot of work going through the various, possible
related errors, but I suppose it will have to do.
Since I can not post to the feedback, could you please post the
following on my behalf?
***** Start of Feedback *****
Dear SQL Server Feedback:
0) Requiring a Windows Live id account in order to post is rather
unfriendly. I have not been able to get one set up. Or rather,
apparently, I did set one up, but it does not work. An alternative
way, such as E-mail, would be a good idea. This is being posted on my
behalf.
1) I am developing an application that will use SQL Server. Because
I want a friendly application and I want validated data, I want to
have db constraints. There are some complications.
First, I want to be able to detect which constraint failed so I
can return an appropriate return code so that I can set focus
appropriately in the front-end. I suggest a function
error_constraint() which would return the name of the constraint that
failed. Currently, I am going to have to write a function to parse
the relevant error messages. This will be prone to breaking should
you change the error messages.
Second, there is no defined order (that I know of) for the order
of checking of the constraints. I would like them to fire in an order
that makes sense to my front-end. I realise that many will not care
about the order and consider speed more important. I am fine with it
defaulting to optimise for speed, but I would like to be able to
specify the order.
Sincerely,
Gene Wirchenko
genew@ocis.net
***** End of Feedback *****
Sincerely,
Gene Wirchenko
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
Constraint Errors: What Blew Up? Gene Wirchenko <genew@ocis.net> - 2012-05-21 15:52 -0700
Re: Constraint Errors: What Blew Up? Erland Sommarskog <esquel@sommarskog.se> - 2012-05-22 07:27 +0000
Re: Constraint Errors: What Blew Up? Gene Wirchenko <genew@ocis.net> - 2012-05-22 11:12 -0700
Re: Constraint Errors: What Blew Up? Erland Sommarskog <esquel@sommarskog.se> - 2012-05-22 23:51 +0200
Re: Constraint Errors: What Blew Up? Gene Wirchenko <genew@ocis.net> - 2012-05-22 17:00 -0700
Re: Constraint Errors: What Blew Up? Erland Sommarskog <esquel@sommarskog.se> - 2012-05-23 07:21 +0000
Re: Constraint Errors: What Blew Up? Gene Wirchenko <genew@ocis.net> - 2012-05-23 09:07 -0700
Re: Constraint Errors: What Blew Up? Erland Sommarskog <esquel@sommarskog.se> - 2012-05-23 23:32 +0200
Re: Constraint Errors: What Blew Up? Gene Wirchenko <genew@ocis.net> - 2012-05-23 15:03 -0700
Re: Constraint Errors: What Blew Up? Erland Sommarskog <esquel@sommarskog.se> - 2012-05-24 07:40 +0000
csiph-web