You are here: Re: how to specify the column name « MsSQL Server « IT news, forums, messages
Re: how to specify the column name

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация