Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
matta0990
Starting Member
44 Posts |
Posted - 2011-04-22 : 07:44:05
|
| Hi, Im wanting to restrict the users input into a database, e.g, only being able to enter the values (mr, mrs, miss etc...) into the "Title" field.Is this possible to do when creating the table.I was thinking summit likeCREATE TABLE Customer (CustomerID SMALLINT NOT NULLCONSTRAINT CustomerID__PK PRIMARY KEY, Title VARCHAR (10) NOT NULLCONSTRAINT Title (Mr, Mrs, Miss),summit along those linesThank YouM Atkinson |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-04-22 : 07:57:09
|
| CREATE TABLE #Customer(CustomerID SMALLINT NOT NULL CONSTRAINT CustomerID__PK PRIMARY KEY ,Title VARCHAR (10) NOT NULL CONSTRAINT CK_Title CHECK (Title IN('Mr', 'Mrs', 'Miss')))JimEveryday I learn something that somebody else already knew |
 |
|
|
matta0990
Starting Member
44 Posts |
Posted - 2011-04-22 : 08:09:03
|
| ahh, thank you. I should have known that.....M Atkinson |
 |
|
|
|
|
|