|
Posted by DickChristoph on 06/14/06 00:53
Hi Gobi
Not sure if you meant how to define the table or query it But here is how
you would define it.
Create table accountnums(
row_id int not null identity(1,1) Primary Key,
acc_no varchar(6))
alter table accountnums add CONSTRAINT CK_acc_no CHECK (acc_no LIKE
'[A-Z][A-Z][0-9][0-9][0-9][0-9]')
insert accountnums(acc_no) values('aa1234') --OK
insert accountnums(acc_no) values('AA1234') -ok
insert accountnums(acc_no) values('A11234') --Generates error.
--
-Dick Christoph
"gobiparthi" <gobi.sdce@gmail.com> wrote in message
news:1150186162.136272.244460@g10g2000cwb.googlegroups.com...
> Dear friends,
>
> If i want to specify the column name as "acc_no" then it
> total size is 6 it must get the first two letters as alphapets and the
> remaining 4 as numbers for this how to write the query?. Please reply.
>
> By,
> Gobi S.
>
Navigation:
[Reply to this message]
|