Click to See Complete Forum and Search --> : Primary Key


NV2002
October 18th, 2007, 05:41 AM
Hi All,

Is there any way to make the "Primary Key" generate itself? I think in an
Acess database there is an option so that whenever you enter a new line it automatically generates a Unique Primary Key. I don't see how to do this in a SQL Server Database? Perhaps I just missed it. This is new to me.Or is there some VB code that will make a unique key whenever a new line of data is entered. Thanks in Advance.

Nick

andreasblixt
October 18th, 2007, 05:47 AM
See the 'Identity' property for the column in question (or the table.) The column must be an int for it to work, and there can only be one Identity column.

NV2002
October 18th, 2007, 06:27 AM
Thanks so much :) . I was looking all over and could not figure that out.
I just tried it and it works.