Results 1 to 3 of 3

Thread: Impersonate to Create Database

  1. #1
    Join Date
    Jul 2010
    Posts
    2

    Impersonate to Create Database

    Dear all,

    I have sysadmin role. I am testing a Windows Logo to see if it can create database sucessfully. However, I'm getting an error saying: CREATE DATABASE permission denied in database 'master'.

    Here is the scripts I ran:

    USE Master;
    EXECUTE AS USER = 'Domain\uid';
    Create Database test;

    How come I am getting permission deined? I queried the system view. This Windows logon does have permission to Create Any Database.

    PS: I have issued the following statements to the server:
    REVOKE CONNECT FROM GUEST;
    REVOKE VIEW ANY DATABASE FROM public;

    Does the error has something to do with these Revoke statements?

    Thank you!

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    What kind of sql permission does that windows accoung have? Is it in any server role?

  3. #3
    Join Date
    Sep 2005
    Posts
    168
    Database creation is a server level permission, so you have to impersonate the login and not the database (master) user.

    EXECUTE AS LOGIN = 'Domain\uid';

    --HTH--

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •