0

Hello I am trying to grant access for a stored procedure to be able to create a database. I am currently getting an error when running a backup restore script from the application: "CREATE DATABASE permission denied in database 'master'"

I tried to grant access to the restore SP to create database

GRANT CREATE DATABASE ON dbo.my_stored_procedure TO [IIS APPPOOL\myAppName];

However this command gives me the following error

Incorrect syntax near 'CREATE DATABASE..'.

Here is the basics of the Sproc:

RESTORE DATABASE @new_db_name 
FROM DISK = @file_path
WITH RECOVERY,

MOVE 'CurrentDB' TO @new_db_file,
MOVE 'CurrentDB_log' TO @new_db_log

1 Answer 1

1

Your syntax is wrong. You don't grant database permissions on something. You grant to a user or role.

http://msdn.microsoft.com/en-gb/library/ms178569.aspx

You can grant execute on a sproc though. That may be enough to get the database permissions you need. If not, then either give the executing user the permissions, or look into impersonation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.