>>That's not true. GO just separates batches in SSMS. The creation of stored procedure must be the only thing in the batch.
>>
>>In other words, GO in the code above has nothing to do with the temp tables.
>
>DECLARE @temp INT
>SET @temp = 1
>
>GO
>
>print @temp
>
>yields:
>Msg 137, Level 15, State 2, Line 2
>Must declare the scalar variable "@temp".
>
>
>ergo my previous assertion of clear local variables is true...
If we're talking about variables, then yes, of course. But the topic of the discussion was about temp tables.
If it's not broken, fix it until it is.
My Blog