Well I have a DB with some records. And I would like that amount of records to double. I do not want to do double looping to show double quantity, I would literally duplicate all the records in the table. Is there any way to accomplish this?
Well I have a DB with some records. And I would like that amount of records to double. I do not want to do double looping to show double quantity, I would literally duplicate all the records in the table. Is there any way to accomplish this?
Friend makes an insert and in values you make a select, like this:
INSERT INTO [Database].[dbo].[Table]
([Coluna1]
,[Coluna2])
select Coluna1, Coluna2 from Table
GO
This will duplicate your table, as it will insert everything that already exists in your table.
Hope it helps. [] 's
Use insert
together with select
, data types in select
and insert
must be the same or compatible, it is also possible to use other clauses like where
, join
etc
INSERT INTO tabela(c1, c2, c3) SELECT c1, c2, c3 FROM tabela