0

What is Identity in SQL

@@IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT are similar functions because they all return the last value inserted into the IDENTITY column of a table. @@IDENTITY and SCOPE_IDENTITY return the last identity value generated in any table in the current session. However, SCOPE_IDENTITY returns the value only within the current scope; @@IDENTITY is not limited to a specific scope. IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the identity value generated for a specific table in any session and any scope.

9th Nov 2016, 8:48 AM
Akwin Lopez
Akwin Lopez - avatar
1 Antwort
0
So... what is your question exactly? I'm just gonna go ahead with the title. The Identity value is the UNIQUE value. It is generated, so you don't have to worry about setting it yourself. See, in a table, if you had two columns that said GroupName and Username, you have a good chance of getting duplicates there. For instance two Users share the Username "John Smith" and at the same time are in the same group. Now the only way to separate the two entries is by adding a unique value - - > the ID. The ID starts at "1" and adds "1" per entry in the specific table by default I believe, but you can always change that if you need something else. This allows you for a pinpoint accurate differencing. Hope this helps! :)
2nd Jun 2017, 4:59 AM
PhilS InstrumentalS
PhilS InstrumentalS - avatar