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
 Other Forums
 MS Access
 Creating additional rows based on a field value

Author  Topic 

Lenham
Starting Member

6 Posts

Posted - 2005-06-22 : 22:00:30
Hi,

I need to copy and append x rows in to a table, which contains a field that holds the value of x.

An ugly way to achieve this could be by creating a macro that runs 2 queries the first would append all rows where the value of x is greater than 0.

The second query would reduce all x >0 by one.

But this macro would need to be run so many times depending on the highest orginal value of x and would need tyo be manually run.

Please can anyone suggest a neat alternative to this.

I would apprectiate your ideas.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-06-22 : 23:11:33
Read this:

http://www.sqlteam.com/item.asp?ItemID=3332

And also read the original article and its comments. You might also want to search SQL Team for "tally" or "sequence table".
Go to Top of Page
   

- Advertisement -