I'm really puzzled by this one!! I'm sure it's simple but really can't figure it out!!

```
DECLARE @jobid INT = 100
   IF (@JobID >= 0)
 BEGIN 
SELECT * into #tmp FROM Persons 
 end
    ELSE
 BEGIN
SELECT * into #tmp FROM Persons1 
 end

```

It gives an error that the `#tmp` table already exists! Why it would validate both statements !

Of course my original query is huge and doing more, but that's a sample to illustrate my error.

Can anybody explain it please?

The `#tmp` table is not there, even when you try to drop it or change the name, still the engine validates both statements!

I'm using 2008 R2.

Thanks
Jason