Hi,
Can any one tell me how can I create auto number (similar feature to MS Access) i.e. autmatic increament by 1 in MS SQL 2005 (without using any script)
make the column an identity
CREATE TABLE test(id INT IDENTITY, SomeOtherVAlue varchar(50))
INSERT test VALUES( 'A' )
INSERT test VALUES( 'B' )
INSERT test VALUES( 'C' )
INSERT test VALUES( 'D' )
INSERT test VALUES( 'E' )
INSERT test VALUES( 'F' )
GO
SELECT * FROM Test
id SomeOtherVAlue
-- --
1 A
2 B
3 C
4 D
5 E
6 F
Denis the SQL Menace
http://sqlservercode.blogspot.com/
|||i have to got the answer
Use Identity Specification property of column
No comments:
Post a Comment