Here is a sample code:
if object_id('tempdb..
create table
ID int,
Name varchar(20)
)
insert into
insert into
insert into
insert into
insert into
select * from
if object_id('tempdb..#TempList') is not null drop table
drop table
create table
ID_New int,
AnotherID int,
Name_New varchar(40)
)
insert into
insert into
insert into
insert into
insert into
select * from
This results in the following error:
Msg 2714, Level 16, State 1, Line 19
There is already an object named '#TempList' in the database.
Can't I reuse the same temp table name in the same SQL script? Is there a way to reuse the same temp table name?
Thank.
Mattb source
share