There is a User Table.
Id Name Surname Address OID
1 n1 s1 a1 24
2 n2 s2 a2 24
3 n3 s3 a3 24
4 n4 s4 a4 12
I want to duplicate rows where OID = 24. I wrote below query but I got error.
INSERT INTO [User] ([OID],[Name],[Surname],[Address]) SELECT * FROM [User] Where OID = 24
Error:
The select list for the INSERT statement contains more items than the
insert list. The number of SELECT values must match the number of
INSERT columns.
How can Insert these rows w/o error? Also I dont know how many records will return from SELECT statement, sometimes it can be 1 sometimes 5, sometimes 15 etc.
your
select *is retrieving 5fields, but you only caninsert4.So, you must the
fieldsto insert