SAP Knowledge Base Article - Preview

3133492 - isnull() always does permission check on second arg even when it's not executed - SAP ASE

Symptom

 

  • isnull() always does permission check on second arg even when it's not executed. e.g.

-- when "enable granular permissions" is NOT enabled --

1> select isnull(0.0, derived_stat(1, 0, 'sput'))
2> 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 --

1> select isnull(0.0, derived_stat(1, 0, 'sput'))
2> 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.

1> select coalesce(0.0, derived_stat(1, 0, 'sput'))
2> go

---------------------------
0.000000


1> select case when 0.0 is null then derived_stat(1, 0, 'sput') else 0.0 end
2> go

---------------------------
0.000000


Read more...

Environment

  • SAP Adaptive Server Enterprise (ASE)

Product

SAP Adaptive Server Enterprise 15.7 ; SAP Adaptive Server Enterprise 16.0

Keywords

isnull(), coalesce(), case EXPRESSION, Msg 10331, Msg 10304 , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , Known Error

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.