|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, November 16, 2009 1:34 PM
Points: 35,
Visits: 55
|
|
Hi, I'm just wonder what is the best way or is it even possible to have a customer error message for a simple check constraint such as.
ALTER TABLE tblJobsCL ADD CONSTRAINT CK_PlannedEndDate_2 CHECK (PlannedEndDate >= PlannedStartDate)
All the error message handling can I find in my books or online seem to be for triggers.
Thank for your help Asta
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:30 AM
Points: 37,742,
Visits: 30,021
|
|
You can't put a custom error in a check constraint.
Two options. 1) (recommended) Use a check constraint, have the front end app handle the error and produce whatever custom error that you want
2) use a trigger.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, November 16, 2009 1:34 PM
Points: 35,
Visits: 55
|
|
Thanks, glad I asked, saves me looking for something that does not exist.
Asta
|
|
|
|