I have table in Database and the primry key is 'ID', Just I want to ask how can I make it AUTOINCREMENT
I know that's esay Q, but I dont know how can I do it.
thanks
I have table in Database and the primry key is 'ID', Just I want to ask how can I make it AUTOINCREMENT
I know that's esay Q, but I dont know how can I do it.
thanks
There is a property "Identity Specification". Expand that one, you can chose Increment value, and Increment Seed
In Sql Server define the column like this...
[PrimaryID] [int] IDENTITY(1,1) NOT NULL
Then you can add a constraint making it the primary key.
MySQL: http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
Oracle http://webxadmin.free.fr/article/oracle-autoincrement-columns-134.php
SQL Server: http://forums.devx.com/showthread.php?t=151539
Since you listed ASP.NET, I'm going to assume you are running a SQL Server 2005/2008. If you want to use the GUI, then follow these steps:
Go to column properties. There you have Identity specification properties. Expand the same. Next you set Is Identity as Yes. Then you can set Identity Increment value and Identity seed value as per requirement. By default it gets set to 1.
For Oracle it is a bit more non-trivial. You first have to create a sequence and then a trigger.