0

I've been tasked with creating a usergroup where users of a database would be able to create objects, but only under the schemas of their own usernames. As an example user foo\bar would only be able to create objects on the schema 'foo\bar'. Is this something that can be done?

I'm working on MS SQL Server 2012. Any feedback would be greatly appreciated.

1 Answers1

0

Not a complete answer but the first thing that comes to my mind: when you create a user, also create the schema and give that user create permissions on that schema.

CREATE USER 'Foo\bar' --FOR LOGIN / WITHOUT LOGIN ?? see url below
CREATE SCHEMA 'Foo\bar'
GRANT CREATE TABLE ON 'Foo\bar' TO 'Foo\bar'

See: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-user-transact-sql and https://learn.microsoft.com/en-us/sql/t-sql/statements/grant-database-permissions-transact-sql

ArieKanarie
  • 944
  • 1
  • 15
  • 29