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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -