Insert values to the identity column in SQL Server:
• Identity field is usually used as a primary key.
• When you insert a new record into your table, this field automatically assigns an incremented value from the previous entry.
• Usually, you can't insert your own value to this field.
SET IDENTITY_INSERT tbl_product2 ON
For one rows Values:
insert into tbl_product2(id ,name, catid, price, qty) values(
12, 'Fashion', 2, 1223, 11)
For More than one rows value
insert into tbl_product2(id ,name, catid, price, qty)
select * from tbl_product where id=12
For More than one rows value
insert into tbl_product2(id ,name, catid, price, qty)
select * from tbl_product
SET IDENTITY_INSERT tbl_product2 OFF
Ещё видео!