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
 Auto Increment in Design Time

Author  Topic 

Firefly17
Yak Posting Veteran

78 Posts

Posted - 2005-09-04 : 23:53:28
Hi

Could anyone tell me how can I set auto increment to a field in MSSQL at design time? So that whenever I insert a new record from VB, it will insert that new record incrementing the field which is not a primary key automatically.

Thank you very much for everyone who are constantly helping me...

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-09-05 : 00:01:16
create table tablename(
col1 [numeric type] identity(1,1),
.
.
.
)

I usually set the numeric type to bigint

HTH

--------------------
keeping it simple...
Go to Top of Page

Firefly17
Yak Posting Veteran

78 Posts

Posted - 2005-09-05 : 00:09:53
Tks alot for your prompt reply... I can set in the database by setting the idetity Yes, Identity seed 10000, increment 1..

right?
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-09-05 : 00:53:42
yes, you can

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -