July 25, 2013 at 1:05 am
CREATE TABLE Production.Categories(
categoryid INT IDENTITY(1,1) NOT NULL,
categoryname NVARCHAR(15) NOT NULL,
description NVARCHAR(200) NOT NULL DEFAULT ('')
)
This is my create table statement in this [categoryid INT IDENTITY(1,1) NOT NULL] what is the use of IDENTITY data type
July 25, 2013 at 1:27 am
Identity is not the data type, INT is.
The identity property specifies that this column is autopopulated by an integer, starting at 1 and adding 1 for each new row.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 25, 2013 at 4:05 am
Koen Verbeeck (7/25/2013)
Identity is not the data type, INT is.The identity property specifies that this column is autopopulated by an integer, starting at 1 and adding 1 for each new row.
Just to make it clear: columns can be set an Identity if it's constrained to be nonnullable and it is one of the following datatypes:
int, bigint, smallint, tinyint, decimal or numeric with scale of 0
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy