1. Requirements: Copy all data from a id= ' 1 ' in the table T_user
(1) Premise: There is no primary key in the table
Statement: INSERT INTO T_user select * from T_user where id= ' 1 ' or
Insert into T_user (id,name,sex) Select from Id,name,sex from T_user where id= ' 1 '
Results: There were two identical data of id= ' 1 ' in the table;
(2) Premise: ID is primary key
Statement: (set SqlParameter parameter when. NET link SQL Server) insert into T_user select @Id, name,sex from T_user where id= ' 1 ', @Id pass appropriate arguments
Results: There are two data in the table except the IDs, the other columns are the same;
2. Requirements: Copy part of id= ' 1 ' data from table T_user
Statement: INSERT INTO T_user select Id,name,' 1 ' from T_user where id= ' 1 '
3. Requirements: Copy some of the information in table T_course to the T_user table
Statement: INSERT INTO T_user (id,name,sex) Select @Id, name,sex from T_course where XXXX
SQL replication Features