Thursday, February 9, 2012

About Check Constraint

Dear all,
I know Check Constraint can help stop some unwanted data pattern insert into
the field.
It can also return a system message about this.
How can I modify the check constraint return system message to a more user
friendly message in SQL Server?
IvanOn 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
> Dear all,
> I know Check Constraint can help stop some unwanted data pattern insert into
> the field.
> It can also return a system message about this.
> How can I modify the check constraint return system message to a more user
> friendly message in SQL Server?
> Ivan
Use a TRY / CATCH block in your procedure to catch the error and
handle it accordingly.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Are TRY & CATCH SQL command?
Ivan
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
'?:1181802475.387039.108510@.d30g2000prg.googlegroups.com...
> On 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
>> Dear all,
>> I know Check Constraint can help stop some unwanted data pattern insert
>> into
>> the field.
>> It can also return a system message about this.
>> How can I modify the check constraint return system message to a more
>> user
>> friendly message in SQL Server?
>> Ivan
> Use a TRY / CATCH block in your procedure to catch the error and
> handle it accordingly.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>|||> Are TRY & CATCH SQL command?
Yes, introduced in SQL Server 2005.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ivan" <ivan@.microsoft.com> wrote in message news:eq1CIi7rHHA.1848@.TK2MSFTNGP03.phx.gbl...
> Are TRY & CATCH SQL command?
> Ivan
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
> '?:1181802475.387039.108510@.d30g2000prg.googlegroups.com...
>> On 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
>> Dear all,
>> I know Check Constraint can help stop some unwanted data pattern insert
>> into
>> the field.
>> It can also return a system message about this.
>> How can I modify the check constraint return system message to a more
>> user
>> friendly message in SQL Server?
>> Ivan
>> Use a TRY / CATCH block in your procedure to catch the error and
>> handle it accordingly.
>> --
>> David Portas, SQL Server MVP
>> Whenever possible please post enough code to reproduce your problem.
>> Including CREATE TABLE and INSERT statements usually helps.
>> State what version of SQL Server you are using and specify the content
>> of any error messages.
>> SQL Server Books Online:
>> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
>> --
>

No comments:

Post a Comment