I'm sorry if this has been posted before, but I can't seem to find answers. I want to add integers from a certain start point to a certain end point to a temp table.
Let's say I have a table of vehicles. Each vehicle has a from and to year. For example, a Ford Mustang GT might have the same body style from 2006 to 2014.
So, I create the table
create table #TempYears
(
intYearID int
)
I can get the min and max years
SELECT min(yearFrom) As minYear,
max(yearTo) AS MaxYear
FROM vehicle
But I'm not sure how to put the two together.
Thank you