Insert an autonumber field on SQL Server
Written on February 2, 2008 – 4:25 pm | by André Gomes
Thanks David for your comment on my post.
Now i want to rectify the tip i give to you yesterday.
The best way to make an autonumber field is the Identity ”process” - which i didn’t know… is:
CREATE TABLE Users( Id Identity(1,1), Name nvarchar(50), Email nvarchar(50), )
INSERT INTO Users(Name, Email)
VALUES ('Andre', 'aslgomesATgmailDOTcom')
The Identity sintax is: Identity(value start,increment).
More at: MSDN - Identity
Veja também:
- Insert a uniqueidentifier field on SQL Server
- Oracle - Create an autonumber field
- MSDN Academic Alliance
- Aquisição de um Macbook Pro à AppleStore
- DTD’s, XML válidos e XML bem formados
Tags: microsoft, programação, sql, sql server
