UFN_APPUSER_CUSTOMAUTHUSERID_OR_USERNAME
This will return the CUSTOM_AUTHENTICATION_USERID of an application user if one exists, otherwise it will return the username.
Return
Return Type |
---|
nvarchar(255) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@APPUSERID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_APPUSER_CUSTOMAUTHUSERID_OR_USERNAME(@APPUSERID uniqueidentifier)
returns nvarchar(255)
with execute as caller
as begin
return (select
COALESCE(case when len(APPUSER.CUSTOM_AUTHENTICATION_USERID) > 0 then APPUSER.CUSTOM_AUTHENTICATION_USERID else coalesce(APPUSER.USERNAME, APPUSER.DISPLAYNAME) end, '')
from APPUSER where ID = @APPUSERID)
end