Tuesday, January 26, 2016

What is an Identity?

  •         Identity (or AutoNumber) is a column that automatically generates numeric values.
  •          A start and increment value can be set, but most DBA leave these at 1.
  •          A GUID column also generates numbers; the value of this cannot be controlled.
  •          Identity/GUID columns do not need to be indexed.
  •          SELECT @@IDENTITY - returns the last IDENTITY value produced on a connection
  •          SELECT IDENT_CURRENT ('tablename') - returns the last IDENTITY value produced in a table
  •          SELECT SCOPE_IDENTITY() - returns the last IDENTITY value produced on a connection.


No comments:

Post a Comment