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 Greg D. Moore \(Strider\) on 01/25/07 02:42

"amaxen" <Amaxen1@gmail.com> wrote in message
news:1169681707.525338.145700@13g2000cwe.googlegroups.com...
>
> When creating the table, use the Identity keyword, and an int or bigint
> type.
>

NOTE: The numbers will be sequential but not necessarily contiguous.

If you have a rollback for example the numbers wioll be "used" up.


>
> Thus (from BOL)
> IF OBJECT_ID ('dbo.new_employees', 'U') IS NOT NULL
> DROP TABLE new_employees
> GO
> CREATE TABLE new_employees
> (
> id_num int IDENTITY(1,1),
> fname varchar (20),
> minit char(1),
> lname varchar(30)
> )
>
>
>
>
> On Jan 24, 2:42 pm, "HandersonVA" <handerso...@hotmail.com> wrote:
>> 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

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