I am pretty new to SQL. I am running SQL 2000 on a Windows 2000 server.
Here is my problem:
I have a table containing multiple customers. The table contains customer
number, name, address and a quantity of coupons that they should receive and
a number that the sequence should begin with. I need to generate the
specified number of coupons and number them sequentially starting at X and
then incrementing by 1 until the specified quantity has been generated. My
front end application would then generate a report where each coupon would
be its own page. When the coupons are printed it would be for multiple
companies.
I know that on my front end I could use a brute force method to create a
table containing a record for each coupon. I am looking for a more subtle
way of doing it in SQL if I can. I would like to create some sort of user
defined function that would return this table. I would want to provide the
number of companies to generate coupons for.
Any suggestions or help would be greatly appreciated.
Thank you