• dbadude78 (8/31/2012)


    Hi

    Thanks for the quick reply. As a test i executed the whole script on my local instance. But got a the following message "Msg 297, Level 16, State 1, Procedure Audit_Server, Line 13

    The user does not have permission to perform this action"

    I can confirm the login has been created with the dbcreator rights.

    got it;

    if a normal user calls that procedure, it would fail, because the normal user doesn't have permission to create database.

    you would need to use EXECUTE AS on the procedure, if normal users are going to call it.

    --the EXECUTE AS must be a user in the database...not a login

    CREATE procedure pr_CallBoostedSecurityProcess

    WITH EXECUTE AS 'superman'

    AS

    BEGIN

    'do priviledges stuff

    --dbcc freeproccache

    CREATE DATABASE MyDatabase

    END

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!