title: Check if user has CREATE DATABASE permissions
body: <p>I want to check if the currently logged in user to my SQL server has permissions to create databases.</p>
  
  <p>I've tried the following statements:</p>
  
  <p><code>SELECT HAS_PERMS_BY_NAME(db_name(), 'DATABASE', 'CREATE')</code></p>
  
  <p><code>SELECT HAS_PERMS_BY_NAME(null, 'DATABASE', 'CREATE')</code></p>
  
  <p><code>SELECT HAS_PERMS_BY_NAME(null, null, 'CREATE DATABASE')</code></p>
  
  <p>But every single one of them returns <code>NULL</code> instead of <code>1</code>, although I indeed have permissions to create new databases.</p>
  
  <p>I assume it should return <code>1</code> by running <code>SELECT HAS_PERMS_BY_NAME(null, null, 'VIEW SERVER STATE');</code>, which returns <code>1</code> :)</p>
  
  <p>What am I missing?</p>