May 18, 2006 at 10:38 am
In Access we had the possibility to implement a validation rule when creating a field, so that it would only accept certain values. For the life of me I can't find a similar option in Microsoft SQL Server Management Studio Express. I've been searching google for the past half hour and the only thing I've found was a reference to the fact that Microsoft did away with the validation option and instead, allows one to create their own data type which allows them to do the same thing. But again, I can't find any info on how to do this. Any help would be much appreciated.
May 19, 2006 at 4:54 am
http://www.devx.com/dotnet/Article/22644
This explains how to create a UDT in VB.Net or C# and register it in SQL 2005 so that it is a datatype like char or varchar, except it follows your rules.
Look at 5.3 and 5.5 for more info on this.
May 19, 2006 at 6:22 am
Try a check constraint at the column level. I believe Express supports it.
MG
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
May 19, 2006 at 8:45 am
Welcome to SQL Server!
You want to set up column constraints.
Here's a decent article describing contraints with a few examples.
http://www.mssqlcity.com/Articles/General/using_constraints.htm
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply