|
Question : Duplicate rows in Datatable
|
|
I hava a datatable with 10 rows. I need to duplicate those rows. How is best to do this? (Then I will add another column to identify each row. ).
|
|
Answer : Duplicate rows in Datatable
|
|
the SPROC would be like this... (you'll need to add the CREATE PROCEDURE heading etc)
select * into #temp from yourtable alter table yourtable add idx int go update yourtable set idx = 1 insert into yourtable select #temp.*,2 from #temp insert into yourtable select #temp.*,3 from #temp insert into yourtable select #temp.*,4 from #temp insert into yourtable select #temp.*,5 from #temp drop table #temp
|
|
|
|