June 13, 2005 at 4:31 pm
Hi,
What I want is to create a auto number when I do an insert into a table. The only way I found was to do an temp table using the into statement in Select. Anybody have nicer way to do this?
Thanks
Mark
June 13, 2005 at 4:50 pm
Just add the IDENTITY() property to a column with a number in your table. If you do not know how IDENTITY works I suggest you look it up in Books Online, but here is an example of a table using it:
CREATE TABLE foo (
bar INT NOT NULL IDENTITY(1,1)
)
June 13, 2005 at 7:39 pm
The identity function will assign a unique number for each table as Chris said. However I would suggest you search for articles or threads that deal with primary keys and their uses.
HTH Mike
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply