Background: There\'s a stored procedure which does \"stuff\" with a temp table of a given name. The procedure is generic in that it inspects the schema of the temp table and
since i dont have sql 2008, i cannot test it. however as far as i know, this is a parser issue explicitly with temp tables. the same would work fine with normal tables
to sort this out, just split your code with logical GO statements
ideally: check for existence of temp tables before you create your temp tables, drop them if they exist, fire a go, do the creation of temp tables again, fire a go, then any post processing, fire a go, finally drop them again and fire the last go
you might also want to try and use the table variable instead of temp tables if above does not solve it for you