hi

How do you create a tempory table inside an if/else statment where the contents of the table are different but the columns are the same

eg

Code:
if @Interval = 0
begin
	select x,y,z into #Ts_Results
end
else
begin
	select x,y,z into #Ts_Results where [Some condition to limit x,y,z]
end

--Do further processing on #Ts_Results
doing that i get an error that #Ts_Results exists, so i tried a create table before the if and the same error occurs

any ideas?

thanks