Autonumber set to integer with the identity property, use decimal for the other
Create table table_name(
id [int] IDENTITY (1, 1) NOT NULL,
price [decimal](10, 2) NULL)
)
Actually the number of places allowed in the decimal can be adjusted based on how big you think the number will get. This one contains 10 places, 2 of which are to the right of the decimal point. The automunber will start with one and increment by one each time.
By the way ID is not a really good name for a field. Use PriceID or something similar. Later on (when you have 50 tables) you will want to know which table this ID relates to, so it is better to start with a unique name now.
You seems not to understand my question.
I need this to work with MS Access
I have copied this code in the SQL VIEW of the Acces query
and a syntax error occured
As far as I know identity works with MS SQL Server
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.