Please see the code below:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE Test
AS
BEGIN
begin
select * into #dbreviews from dbreviews
end
drop table #dbreviews
begin
select * into #dbreviews from dbreviews
end
END
GO
The error I get is:
There is already an object named
'#dbreviews'in the database.
Questions like this: There is already an object named '#columntable' in the database are telling me this should be possible.
As per SQL Server specification, it is not allowed. Please refer to the documentation.
If more than one temporary table is created inside a single stored procedure or batch, they must have different names.
You are creating two temporary tables, with the same name #dbreviews. This is not allowed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With