IT Questions and Answers :)

Tuesday, April 2, 2019

On MS SQL Server, which column property lets you indicate an auto increment column?

On MS SQL Server, which column property lets you indicate an auto increment column?

  • incremental
  • identity
  • incremental_identity
  • increment 

 
On MS SQL Server, which column property lets you indicate an auto increment column?

EXPLANATION

Identity let's you say that column have an auto increment value, from X by Z, for example: identity(1,1), says start on 1 and sum 1 by 1 (1,2,3,4,5,6......). identity(55,10) says start on 55 and go 10 by 10 (55,65,75,85,95,.....).
This is fine when you have a registry table (like a log, for example), and you need a primary key that always its unique. For that you can use the GetDate() function (that is unique too XD).

SOURCE

https://docs.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property
Share:

0 comments:

Post a Comment

Popular Posts