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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL query to duplicate records X times

Status
Not open for further replies.

Timalaugh

Programmer
Aug 10, 2011
31
US
Hi all...
I have an odd one.
I need to be able to duplicate a record thisMany times where ThisMany is a field in the record. The table I start with only has one record. The problem is I need to do it in one select statement. Any one know how to do this.

thanks very much

Tim
 
Create A numbers table

One field digitid type int

insert values from 1 till XXXX
insert into yourtabel (fields)
Select fields,....
From yourTable
inner join numberstable
on Digitid<=fieldinyourtable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top