sql server - Why does checking if temp table exists when "CONCAT_NULL_YIELDS_NULL" is set to ON doesn't work? -
set concat_null_yields_null off; if object_id ('tempdb..##queryresults') not null drop table ##queryresults;
why if set set concat_null_yields_null
off shown above , temp table ##queryresults
exists, dropped if set on, temp table not dropped when exists?
this works expected on sql server 2014 sp1
set nocount on; set concat_null_yields_null off; create table ##queryresults (foo int); select object_id ('tempdb..##queryresults'); if object_id ('tempdb..##queryresults') not null drop table ##queryresults; select object_id ('tempdb..##queryresults'); go set concat_null_yields_null on; create table ##queryresults (foo int); select object_id ('tempdb..##queryresults'); if object_id ('tempdb..##queryresults') not null drop table ##queryresults; select object_id ('tempdb..##queryresults');
gives
----------- 373576369 ----------- null ----------- 389576426 ----------- null
Comments
Post a Comment