Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 AutoNumber

Author  Topic 

Thuso
Starting Member

1 Post

Posted - 2009-10-30 : 10:37:23
I am new to SQL server. I have developed a database using Sql 2005 and I am running Visual Basic 2005 on top of it. on a table called Fad, I have a field called FadID which I would like it to be an autonumber field which increments from 000001 to 999999 without providing a negative number.

TS

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-30 : 10:41:40
create table Fad (FadID int identity(1,1), other_col...)

creates the table and sets FadID to AutoNumber starting from 1 increasing by 1.

000001 is not a possible format for numeric columns.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-31 : 01:30:29
did you mean generating custom sequences

http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-31 : 03:08:15
or
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=57069

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -