White out a record for each day of a month using temp table data?

I'm looking to write a record or each day of a month(or date range)

I have a query that gets a name, and ID and write it to a temp table

I'd like to generate output with record for each date in the date range


I write a temp table with

JimJames 901111

Marymaples 90891

I'd like output of

1/1/23 JimJames 90111

1/2/23 JimJames 90111

1/3/23 JimJames 90111.....

1/31/23 JimJames 90111

1/1/23 Marymaples 90891

1/2/23 Marymaples 90891

1/3/23 Marymaples 90891.....

1/31/23 Marymaples 90891.....

Any ideas would be very much appreciated....



Joe - you posted this question on SQLServerCentral also and I believe someone posted a link to the solution you were provided in that other thread.

Can you post that here also - so everyone can see how this was resolved?

Yes, here is the solution. The saddest part is "I" asked the question 5 years ago lol
I guess I haven't used it in awhile


hi hope this helps

yes .. if you do not practice .. its gone .. spaced repetition memorization technique .. once a week
if you re collect .. it stays fresh ( even after 20 years you will be able to do )

create data script

drop table if exists #Temp
create table #Temp ( name varchar(100) , id int )
insert into #Temp select 'JimJames', 901111
insert into #Temp select 'Marymaples', 90891

select * from #Temp

declare @startDate date = '2022-03-01' 
declare @endDate date = '2022-07-01' 

; with tallyCTE as 
( SELECT N=number FROM master..spt_values WHERE type = 'P' ) 
	 , dateadd(mm,N,@startDate) 
     tallyCTE a , #Temp b  
     dateadd(mm,N,@startDate) <= @endDate