"Learn a little bit" when learning SQL, many people will deal with identity. Of course, I have only just learned it. Here I write out the identity I understand. Recording
A moment. Because my mind is not very good. Want to deepen understanding and memory in this way. The understanding of identity is all thanks to the Csdn brothers. Thank you here.
Before we understand it, we'll build two tables create TABLE [TA] ([a] char,[b] char); CREATE TABLE [TB] ([C] char)
To implement a merge of a table. But neither table has a primary key. It is easy for us to use it. Identity (int, 1, 1) can automatically implement numbering.
SELECT *, id= identity (int, 1,1) into the ta1 from TA//
SELECT *, id= identity (int, 1,1) into the tb1 from tb//
This allows us to copy the column values of the TA,TB into the table ta1,tb1 and add the ID column.
This makes it easy to combine two tables.
The identity (INT,I,J) Implementation ID increases from I, each time with J. 】
"SELECT * into table1 from table2//execute this SQL statement: Copy all table2 values into table1. 】