Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy rows in SQL Server

Status
Not open for further replies.

dambrose

MIS
Aug 29, 2002
3
US
I have a SQL Server Table that has a column with a number in it. Is there a way that I can query that table to find out what the number is and copy the rows that number of times in a new table.
 
There are two possible answers.

Do you want to
1) read the value from a single column and a single row and take that value and add that many number of rows to a table.
2) Count the number of rows and then add that same amount of rows to a new table or (your asking for trouble) at it to the same table (this would exponentialy grow the size of your table).

for number 2
just do this
while recordsetname <> null
cn.execute(insert statement)
recordsetname.movenext
wend
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top