You are here: Re: automatic number increment in ms sql 2005 « MsSQL Server « IT news, forums, messages
Re: automatic number increment in ms sql 2005

Posted by AlterEgo on 01/24/07 23:16

Handerson,

If you set up a column as an INTEGER IDENTITY column (see BOL), SQL Server
will not store leading zeros. You could get leading zeros out of your select
statments as follows:

select right('00000000' + cast(MyColumn as varchar(25)), 8)

But, the best thing to do is manage leading zeros at the application layer.
Don't have the database always doing that work for you.

-- Bill

"HandersonVA" <handersonva@hotmail.com> wrote in message
news:1169678553.956380.205080@q2g2000cwa.googlegroups.com...
> will it be possible to increase number as below automatically
> 00000001
> 00000002
> 00000003
> ...
>
> whenever the row is inserted, number will be increased like above
> format.
> which data type should I select and do some other setting to record
> like that?
> thanks
>

 

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

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