Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Making duplicate records

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-13 : 10:12:16
Dan writes "How do I making duplicate records with a counter.
I know how to take out duplicated records but I wand to make duplication.

The database has a table named as ADVO_Count. In the
table has a field called family_Count containing
variable number like 0,1,5,15,58 or xxx (int) data,
with other fields? I need to duplicate the records
based on those numbers in this field. If family_Count
>1 then duplicate the record ###-1 times. And out put
this data in to another table (we may call it finish).

The same thing explain in another way:
sql that repeat a row many times is the value "family_Count" column. Like this:

ID ¦ family_Count
1 ¦ 3
2 ¦ 5
3 ¦ 2
4 ¦ 6

sql results:
ID
1
1
1
2
2
2
2
2
3
3
4
4
4
4


Could you please give me a SQL script answer? I
checked curser related questions even the tek-tips.com
still did not get much help.
Thank you very much in advance.

Dan Yang
danqyang@yahoo.com"
   

- Advertisement -