September 26, 2017 at 8:41 am
Christian4143 - Tuesday, September 26, 2017 7:54 AMJust to add:
There is different behavior on SQL-Server 2012. I have to change the statement to (there is no 'if exists')
if object_id ('tempdb..#t') is not null drop table #t
execute ('create table #t (i int, z int)')
select * from #t
GO
-- second Batch
if object_id ('tempdb..#t') is not null drop table #t
create table #t (i int)
execute ('alter table #t add z int')
select * from #tThere is an error on SQL-Server 2012:
Msg 208, Level 16, State 0, Line 3
Invalid object name '#t'.The resut will be i,z.
Read the question! The first batch returns exactly that error!
September 26, 2017 at 8:51 am
Carlo Romagnano - Tuesday, September 26, 2017 8:41 AMChristian4143 - Tuesday, September 26, 2017 7:54 AMJust to add:
There is different behavior on SQL-Server 2012. I have to change the statement to (there is no 'if exists')
if object_id ('tempdb..#t') is not null drop table #t
execute ('create table #t (i int, z int)')
select * from #t
GO
-- second Batch
if object_id ('tempdb..#t') is not null drop table #t
create table #t (i int)
execute ('alter table #t add z int')
select * from #tThere is an error on SQL-Server 2012:
Msg 208, Level 16, State 0, Line 3
Invalid object name '#t'.The resut will be i,z.
Read the question! The first batch returns exactly that error!
sorry for that.
Learning buy doing.
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply