Symptom
- isnull() always does permission check on second arg even when it's not executed. For example:
-- when "enable granular permissions" is NOT enabled --
select isnull(0.0, derived_stat(1, 0, 'sput'))
go
Msg 10304, Level 14, State 1:
Server 'xxx', Line 1:
Only the owner of object 'sysobjects' or a user with 'sa_role' role can run this command.
-----
0.0
-- when "enable granular permissions" is enabled --
select isnull(0.0, derived_stat(1, 0, 'sput'))
go
Msg 10331, Level 14, State 2:
Server 'xxx', Line 1:
Permission denied, database master, owner dbo. You need the following permission(s) to run this command: MANAGE DATABASE.
-----
0.0
- However, coalesce() and CASE expression can be executed with no error.
select coalesce(0.0, derived_stat(1, 0, 'sput'))
go
---------------------------
0.000000
select case when 0.0 is null then derived_stat(1, 0, 'sput') else 0.0 end
go
---------------------------
0.000000
Read more...
Environment
SAP Adaptive Server Enterprise (ASE)
Product
Keywords
isnull(), coalesce(), case EXPRESSION, Msg 10331, Msg 10304 , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , How To
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.
SAP Knowledge Base Article - Preview