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.
| Author |
Topic |
|
woodfoot
Starting Member
1 Post |
Posted - 2006-02-20 : 07:53:35
|
| Having a brain cramp here and don't know where to start. I have 2 tables: vehicles and vehicle_useage. What I would like to do is this:For each distinct vehicle in the vehicle table, I want to make entries for each day of the month taken from a given date. This routine will be scheduled to fire off once a month and populate the vehicle_useage table with vehicle use_dates for each day of the current month and for each VIN from the vehicle table.vehicle table:VIN emp_id------------ ------VIN123456789 620123VIN987654321 620123vehicle_useage table:use_date VIN miles----------- ------------ -----02/01/2006 VIN123456789 002/02/2006 VIN123456789 002/03/2006 VIN123456789 002/04/2006 VIN123456789 0etc....02/01/2006 VIN987654321 002/02/2006 VIN987654321 002/03/2006 VIN987654321 002/04/2006 VIN987654321 0etc...Much appreciated for any help you can give... |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-02-20 : 07:59:04
|
| Don't need a cursor for that:http://www.sqlteam.com/item.asp?ItemID=3332 |
 |
|
|
|
|
|