SQL Flow Field Guide

Check one permission

Read the current session's permission without changing access.

What you are trying to do

A reviewer must check a database permission before requesting a role change.

Work through it

  1. Read the permission name and database scope.
  2. Interpret one as granted, zero as denied, and NULL as unknown or unavailable.
  3. Ask the database owner about the approved role if access is missing.

Check your work

The check changes no permission and the access request names one task and one scope.

Practice SQL

Open in SQL Flow
SELECT HAS_PERMS_BY_NAME(DB_NAME(), 'DATABASE', 'VIEW DEFINITION') AS CanViewDefinitions;

Commands in this lesson