can grant a login only create database with specific name?
-
Thursday, June 28, 2012 1:34 PMinstead of create any database, can it be granted to only specific database name.
All Replies
-
Thursday, June 28, 2012 4:08 PM
No. At least not directly. You could create a stored procedure that creates the database and grant execute to that user. Something like this.
USE master;
CREATE PROC CreateTestDB
WITH EXECUTE AS OWNER
AS
CREATE DATABASE TestDB;GRANT EXECUTE ON CreateTestDB TO Barry;
EXECUTE AS USER = 'Barry';
EXEC CreateTestDB;
REVERTRick Byham, Microsoft, SQL Server Books Online, Implies no warranty
- Marked As Answer by George Zhou Thursday, June 28, 2012 6:28 PM
-
Thursday, June 28, 2012 6:30 PM
thanks, great idea, though it some app vendors usually run their own program not able to use the procedure, but definitely this execute as proc can help in other cases.

