Create duplicates with sql
sql, sql-server, t-sql
Solution
insert into your_table
select col1, col2, concat(col3, '_new') from your_table
Problem
This might sound a bit confusing at first. But I have a table with data and I want to create duplicates of all the rows in this table. So, if i do: ``` SELECT * FROM the_table ``` it lists all the data in this table. Now, i want to create a copy of all returned results, except for that I want to change data for one column (the date). This will make the new rows unique. The reason I want to do this is because I want more data in this table since im building statistics out of it for testing purposes. So, if I have this: ``` **Column1 Column2 Column3** abc aaa bbb abcd aaaa bbbb abcde aaaaa bbbbb The table will now contain: **Column1 Column2 Column3** abc aaa bbb abcd aaaa bbbb abcde aaaaa bbbbb abc aaa bbb_new abcd aaaa bbbb_new abcde aaaaa bbbbb_new ```