Adding upper case letter only constraint in SQL Server -


create table employeestatistics   (        employeeidno int,        name varchar(30),        salary integer,        benefits integer,        position varchar(25),        allowance integer,         dateofbirth integer,        telephone integer,           primary key (employeeidno)   ); 

i want position accept upper case letters. constraint add?

alter table employeestatistics #add constraint 

you can use check constraint compare value upper case value using binary collation or case sensitive collation.

alter table dbo.employeestatistics    add constraint ck_employeestatistics_position   check (upper(position) = position collate latin1_general_bin2) 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -