Click here to Skip to main content
15,906,463 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Hi,

I've tried searching the net and can't seem to ascertain a proper answer for this. I'm trying to get the ID field to auto number so that when new things are appended to the database the field is automatically filled in. I don't want to have to do it through a query though. Loads of things on the net say to put it as an int and set the Identity in the properties, however for me the Identity menu is greyed out. Help?

Thanks.
Posted
Comments
[no name] 11-Dec-11 7:45am    
make sure you are pointing to a number column field
Amir Mahfoozi 11-Dec-11 8:00am    
Press the Plus sign beside the grayed Identity to see more options ;) ...
WurmInfinity 11-Dec-11 8:13am    
Yer its still greyed out.
Amir Mahfoozi 11-Dec-11 8:25am    
The only condition that it's disables is that the data type have set to non natural number data types. So double check it.
WurmInfinity 11-Dec-11 8:26am    
Fixed it, there was a menu on the right to set it to Identity true.

You need a number to make it auto incremented like int or bigint. You click that field and go to the Column Properties found just below the table details, expand Identity Specification, then set Is Identity to TRUE.

This will do it.

Regards,
Eduard
 
Share this answer
 
Comments
Monjurul Habib 11-Dec-11 9:27am    
5!
[no name] 11-Dec-11 20:31pm    
Thanks!
The MS SQL Server uses the IDENTITY keyword to perform an auto-increment feature.
By default, the starting value for IDENTITY is 1, and it will increment by 1 for each new record.
SQL AUTO INCREMENT Field[^]
 
Share this answer
 
Comments
Monjurul Habib 11-Dec-11 9:26am    
5!
RaviRanjanKr 11-Dec-11 9:31am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900