dbadude78 (8/31/2012)
HiThanks 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